It’s 1 or 2 pages explaining how the programs work you will find the Qion in the page 2 in the attachment
(Game: A
INT
9.7 to simulate an ATM
0,1,19, and initial balanc
id. If the id is entered incorrec
is accepted, the main menu is
hoice 1 for viewing the
and 4 for Exit
in. Thus,
Research Problem Page 2 of 2
Add Name
The problem begins with this output, which is the result of the accompanying three Java
programs.
C:\Windows system32\cmd.exe
What is the cup’s color?
Green
Buhat is the cup’s size?
Large
Ok, next
This object is of paper
This object’s size is Large
This object’s color is Green
This object’s volume is null
Date nade this object made Mon Mar 21 10:28:58 EDT 2016
This is the object’s number 1
another object
☆
This object is of paper
This object’s size is small
This object’s color is white
This object’s volume is 1002
Date made this object made Mon Mar 21 10:28:58 EDT 2016
This is the object’s number 1
Afterwards
Press any key to continue
Beginning with this output, trace how the program made it to this place, by trace the
lines of code across the three programs. Document the multiple waystations as the
process moves through the code.
am Reports
Mohammed Aljohani
jven: 2/24/2016
ATM machine) Up
mulate an ATM ma
9, and initial balan
dis entered incorre
, the main menu is
Programming assignment 4
INF 2151 AB
-1 for viewing the
end 4 for exi
Given Mar 28 : due Apr 6
Dahlem 11.1, p. 445 for 100 points
1. Th
of 7
Research Problem Page 707
}
public String getColor()
{
return color;
}//
public void setSize(String sSize)
{
size = sSize;
}
public String getSize()
{
return size;
}
public void setVolume(String sVolume)
volume = sVolume;
}
public String getVolume()
{
return volume;
}
public String getDateCupMade()
dateCup Made = super.dateMade;
return dateCup Made;
}
public int getNumCups
{
return numCups;
}
//
}//end class
Programm
Page 14 of 15
INF 2151 A,B
Program
Name: Mohamm
Date given: 2/24/2016
(Game: ATM machine) Uşe
9.7 to simulate an ATM mac
Given Mar 28 :
Problem 113
0,1.9, and initial balan
Problems
ding the
id. If the id is entered incorres
– the main menu is
Research Problem Page 6 of 7
x
Add Name
public class Cup extends Container
{
//attributes
private String color;
private String size;
private String volume;
private String dateCupMade;
private int numCups;
//constructors
public Cup
Spare
mel
Add Ne
amed
{
//default constructor
super();
color = “white”;
size = “small”;
volume = “100z”;
numCups++;
}//end constructor
public Cup(String sColor, String sSize)
{
super();
color = sColor;
size = sSize;
if (sSize.equals(“small”))
{
volume = “100z”;
}
if (sSize.equals(“medium”))
{
volume = “160z”;
}
if (sSize.equals(“large”))
{
volume = “2002”;
}
numCups++;
}//end constructor
//methods
public void setColor(String sColor)
{
color = Color;
Report 3
Mohammed Aljohani
2/24/2016
nine)
Mmas
4 of 7
an
neramming assignment 4
Research Problem Page 5 of 7
public void printPaperCupo
{
//
System.out.println(“This object is of ” + getMaterial();
System.out.println(“This object’s size is ” + super.getSize();
System.out.println(“This object’s color is ” + super.getColor();
System.out.println(“This object’s volume is ” + super.getVolume());
System.out.println(“Date made this object made” + super.getDateCup Made();
System.out.println(“This is the object’s number” + getNumCups();
}//end print
}//end class
Pre
Name: MO
Page 14 of 15
Research Problem Page 4 of
public class PaperCup extends Cup
{
//attributes
private String color;
private String size;
private String material;
private String volume;
//constructors
public PaperCup
Add Name
Gridpane
{
super();
this.material = “paper”;
}//end constructor
public PaperCup(String sColor, String sSize)
{
super(sColor, sSize);
this.material = “paper”;
}//end constructor
t Name
:
ast Name
//methods
public void setColor(String sColor)
color = sColor;
}
public String getColor()
{
return color;
}//
public void setSize(String sSize)
{
size = sSize;
public String getSize()
{
return size;
}
public String getMaterial
{
return material;
Prog
Name: Mohammed Al
te given: 2/24/2016
ATM machine) Use the one
late an ATM mac
ch Problem Page 2 of 7
Programming assignment 4
initial balanc
INF 2151 A,B
red incorrec
Given Mar 28 ; due Apr 6
nying three Java
n menu is
Problem 11.1, p. 445 for 100 points
iewing the
Enrokit
Problem 11.2, p. 445 for 125 points
11.3, p. 445 for 125 points
Research Problem Page 3 of 7
import java.util.Scanner;
//public class TestCups
public class TestCups
{
public static void main(String[] args)
{
String color, size;
//
Scanner input = new Scanner(System.in);
System.out.println(“What is the cup’s color? “);
color = input.nextLine();
System.out.println(“What is the cup’s size? “);
size = input.nextLine();
//
PaperCup pcup1 = new PaperCup(color, size);
PaperCup pcup2 = new PaperCup();
System.out.println(“Ok, next\n”);
pcup1.printPaperCup();
System.out.println(“another object\n”);
pcup2.printPaperCup0;
System.out.println(“Afterwards\n”);
}//end main
}//end c;lass
am Reports
Mohammed Aljohani
jven: 2/24/2016
ATM machine) Up
mulate an ATM ma
9, and initial balan
dis entered incorre
, the main menu is
-1 for viewing the
Programming assignment 4
INF 2151 AB
Given Mar 28 : due Apr 6
Dahlem 11.1, p. 445 for 100 points
end 4 for exi
1. Th
of 7
Research Problem Page 707
}
public String getColor()
{
return color;
}//
public void setSize(String sSize)
{
size = sSize;
}
public String getSize()
{
return size;
}
public void setVolume(String sVolume)
volume = sVolume;
}
public String getVolume()
{
return volume;
}
public String getDateCupMade()
dateCup Made = super.dateMade;
return dateCup Made;
}
public int getNumCups
{
return numCups;
}
//
}//end class
Programm
Page 14 of 15
INF 2151 A,B
Program
Name: Mohamm
Date given: 2/24/2016
(Game: ATM machine) Uşe
9.7 to simulate an ATM mac
Given Mar 28 :
Problem 113
0,1.9, and initial balan
Problems
ding the
id. If the id is entered incorres
– the main menu is
Research Problem Page 6 of 7
x
Add Name
public class Cup extends Container
{
//attributes
private String color;
private String size;
private String volume;
private String dateCupMade;
private int numCups;
//constructors
public Cup
Spare
mel
Add Ne
amed
{
//default constructor
super();
color = “white”;
size = “small”;
volume = “100z”;
numCups++;
}//end constructor
public Cup(String sColor, String sSize)
{
super();
color = sColor;
size = sSize;
if (sSize.equals(“small”))
{
volume = “100z”;
}
if (sSize.equals(“medium”))
{
volume = “160z”;
}
if (sSize.equals(“large”))
{
volume = “2002”;
}
numCups++;
}//end constructor
//methods
public void setColor(String sColor)
{
color = Color;
Report 3
Mohammed Aljohani
2/24/2016
nine)
Mmas
4 of 7
an
neramming assignment 4
Research Problem Page 5 of 7
public void printPaperCupo
{
//
System.out.println(“This object is of ” + getMaterial();
System.out.println(“This object’s size is ” + super.getSize();
System.out.println(“This object’s color is ” + super.getColor();
System.out.println(“This object’s volume is ” + super.getVolume());
System.out.println(“Date made this object made” + super.getDateCup Made();
System.out.println(“This is the object’s number” + getNumCups();
}//end print
}//end class
Pre
Name: MO
Page 14 of 15
Research Problem Page 4 of
public class PaperCup extends Cup
{
//attributes
private String color;
private String size;
private String material;
private String volume;
//constructors
public PaperCup
Add Name
Gridpane
{
super();
this.material = “paper”;
}//end constructor
public PaperCup(String sColor, String sSize)
{
super(sColor, sSize);
this.material = “paper”;
}//end constructor
t Name
:
ast Name
//methods
public void setColor(String sColor)
color = sColor;
}
public String getColor()
{
return color;
}//
public void setSize(String sSize)
{
size = sSize;
public String getSize()
{
return size;
}
public String getMaterial
{
return material;
Prog
Name: Mohammed Al
te given: 2/24/2016
ATM machine) Use the one
late an ATM mac
ch Problem Page 2 of 7
Programming assignment 4
initial balanc
INF 2151 A,B
red incorrec
Given Mar 28 ; due Apr 6
nying three Java
n menu is
Problem 11.1, p. 445 for 100 points
iewing the
Enrokit
Problem 11.2, p. 445 for 125 points
11.3, p. 445 for 125 points
Research Problem Page 3 of 7
import java.util.Scanner;
//public class TestCups
public class TestCups
{
public static void main(String[] args)
{
String color, size;
//
Scanner input = new Scanner(System.in);
System.out.println(“What is the cup’s color? “);
color = input.nextLine();
System.out.println(“What is the cup’s size? “);
size = input.nextLine();
//
PaperCup pcup1 = new PaperCup(color, size);
PaperCup pcup2 = new PaperCup();
System.out.println(“Ok, next\n”);
pcup1.printPaperCup();
System.out.println(“another object\n”);
pcup2.printPaperCup0;
System.out.println(“Afterwards\n”);
}//end main
}//end c;lass