Subject Computer Science Java Programming

Question

Many gas pumps have display that spin digits (either analog or digital ) while the gas is being pumped into your car's tank. The display's digits change to indicate the amount of gas in the tank and the current price.
Write a program that displays the spinning of the digits. Your GaspumpDisplay class will allow you to create a "gas pump" display with a specified number of display places and will allow specify the highest digit in use . You will simplify a gas pump display by using smaller display of only three digits where the digits are in the limited range of 0-4 inclusive

public class GasPumpDisplay {
publicGasPumpDisplay(int numbeOfPostion){
}
public BooleanhasMoreElement(){
}
private int digit;
private GasPumpDisplay tail;
private int currentDigite;
private static final MAX_DIGIT=4 ;
}

Public class GasPumpTester{
Public static void main (String [] args){
GasPumpDisplay d= new GasPumpDisplay (3);
Output:
000 001 002 003 004 010 011 012 013 014 020 021 022 023 024 030 031 032 033 034 040 041 042 043 044 100 101 102 103 104 110 111 112 113 114 120 121 122 123 124 130 131 132 133 134 140 141 142 143 144 200 201 202 203 204 210 211 212 213 214 220 221 222 223 224 230 231 232 233 234 240 241 242 243 244 300 301 302 303 304 310 311 312 313 314 320 321 322 323 324 330 331 332 333 334 400 401 402 403 404 410 411 412 413 414 420 421 422 423 424 430 431 432 433 434 444

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class GasPumpDisplay {
public GasPumpDisplay(int numberOfPositions){
if(numberOfPositions > 1)
{
tail = new GasPumpDisplay(numberOfPositions-1);
}
position = numberOfPositions;
currentDigit = 0;
}
public boolean hasMoreElement(){
if(currentDigit == MAX_DIGIT && position > 1 && !tail.hasMoreElement())
{
return false;
}
else if(currentDigit == MAX_DIGIT && position == 1)
{
return false;...

This is only a preview of the solution. Please use the purchase button to see the entire solution

$20.00

or $1 if you
register a new account!

Related Homework Solutions

Java Project: Right Triangle Of Stars
Homework Solution
$30.00
Java
Programming
Computer Science
Mathematics
Loops
Input
Output
Conditions
Right Triangle
Base
Hypotenuse
Stars
Statements
Variables
Even Numbers
Odd Numbers
Transformations
Java Programming Assignment
Homework Solution
$20.00
Java Test Application
Java Programming
Program
3-D Geometric Shape
Java Class
Constructor
Java Program With Strings & Integers
Homework Solution
$20.00
Java
Programming
Coding
Strings
Integers
Computer Science
Symbols
Special Characters
Reading
Writing
Rows
Columns
Statements
Conditions
Loops
Java Programming Assignment
Homework Solution
$40.00
Java Programming
Computer Science
Arrays
Dynamic Allocation
ArrayList
Constructor
Simple Mathematical Computations in Java
Homework Solution
$20.00
Java
Programming
Codes
Algorithms
Mathematics
Computer Science
Objects
Summation
Odd Digits
Even Digits
ItemIndex
Functions
Integers
Multiple Values
Statements
Variables
Input
Output
Get help from a qualified tutor
Live Chats