..
12/26/2012 01:19 PM 728 Java1302CMIS141C902Project4.class
12/26/2012 01:18 PM 536 Java1302CMIS141C902Project4.java
12/26/2012 01:13 PM 2,383 SuperJavaIceCreamClass.class
3 File(s) 3,647 bytes
2 Dir(s) 118,631,280,640 bytes free
C:\Users\andy\java\141\p4>java Java1302CMIS141C902Project4
Here is your small chocolate ice cream cone with sprinkles. It's delicious!
Here is your large swirl ice cream cone. It's delicious!
Here is your medium strawberry ice cream cone. It's delicious!
C:\Users\andy\java\141\p4>
public class SuperJavaIceCreamClass
{
private final int MAX_MIX_LEVEL = 10;
private String[] servingSizes = { "small", "medium", "large", "huge", "\"bring a wheelbarrow\"" };
private int currentServingSize;
private boolean readyToServe;
private String[] iceCreamFlavors = { "chocolate", "vanilla", "swirl", "strawberry", "motor oil" };
private int currenticeCreamFlavor;
private boolean activateSprinkles;
public SuperJavaIceCreamClass()
{
this.readyToServe = false;
setSize(4);
setFlavor(4);
setSprinkles(false);
}
public void powerOn() {
this.readyToServe = true;
}
public void powerOff() {
this.readyToServe = false;
setSize(4);
setFlavor(4);
setSprinkles(false);
}
public void setSize(int a) {
if ((a < 0) || (a > this.servingSizes.length - 1)) this.currentServingSize = 4; else
this.currentServingSize = a;
}
public String getSize() {
return this.servingSizes[this.currentServingSize];
}
public void setFlavor(int a) {
if ((a < 0) || (a > this.iceCreamFlavors.length - 1)) this.currenticeCreamFlavor = 4; else
this.currenticeCreamFlavor = a;
}
public String getFlavor() {
return this.iceCreamFlavors[this.currenticeCreamFlavor];
}
public void setSprinkles(boolean a) {
this.activateSprinkles = a;
}
public boolean getSprinkles() {
return this.activateSprinkles;
}
public String serve()
{
String t;
String t;
if (!this.readyToServe) {
t = "Rattle, rattle, hiss, fizz, plop.";
}
else
{
String s;
String s;
if (getSprinkles()) s = " with sprinkles"; else
s = "";
t = "Here is your " + getSize() + " " + getFlavor() + " ice cream cone" + s + ". It's delicious!";
powerOff();
}
return t;
}
public String toString() {
return serve();
}
}