Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

The API for this class is:

public void powerOn()  // sets the machine ready to serve the selected ice cream

public void powerOff()   // set the machine in the off/default state

public void setSize (int)  // selects the size to serve, 0 (small) through 3 (huge)
public String getSize()  // returns the current serving size

public void setFlavor (int)  // selects the flavor, 0 (chocolate), 1 (vanilla), 2 (swirl), 3 (strawberry)

public String getFlavor()  // returns the current flavor selection

public void setSprinkles(boolean)  // turns the sprinkles option on or off

public boolean getSprinkles()   // returns the current state of the sprinkles option

public String serve ()  // returns the prepared ice cream cone report

public String toString ()  // returns the prepared ice cream cone report

Your project is to create a driver class that uses SuperJavaIceCreamClass.  Your driver class must meet the following minimum criteria:

1. Your driver must create at least three ice cream cones and print the reports of those objects.

2. You must create at least two separate objects of type SuperJavaIceCreamClass.

3. At least one of your objects must be used twice to create two different types of ice cream cone.

4. Your driver class must be named Java1306CMIS141C801Project4

Please turn in by the project due date:

1. Your Java1306CMIS141C801Project4.java file

2. A screen shot of your output

Here is an example run. Your output should be similar.

C:\Users\andy\java\141\p4>dir

 Volume in drive C is OS

 Volume Serial Number is A426-EE6D

 Directory of C:\Users\andy\java\141\p4

12/26/2013  01:18 PM   

          .

12/26/2013  01:18 PM   

          ..

12/26/2013  01:18 PM               536 Java1302CMIS141C902Project4.java

12/26/2013  01:13 PM             2,383 SuperJavaIceCreamClass.class

               2 File(s)          2,919 bytes

               2 Dir(s)  118,631,284,736 bytes free

C:\Users\andy\java\141\p4>javac Java1302CMIS141C902Project4.java

C:\Users\andy\java\141\p4>dir

 Volume in drive C is OS

 Volume Serial Number is A426-EE6D

 Directory of C:\Users\andy\java\141\p4

12/26/2012  01:19 PM   

          .

12/26/2012  01:19 PM   

          ..

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();

  }

}

Java, Programming

  • Category:- Java
  • Reference No.:- M9716879
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Java

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As