The api for this class ispublic void poweronnbsp sets the

Assignment Help JAVA Programming
Reference no: EM13347262

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    <DIR>          .

12/26/2013  01:18 PM    <DIR>          ..

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    <DIR>          .

12/26/2012  01:19 PM    <DIR>          ..

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

  }

}

Reference no: EM13347262

Questions Cloud

Part -11 write down the households budget constraints for : part -11. write down the households budget constraints for period 1 and 2 and identify the current account.2. derive
Write an email memo and letter it has to be canadian store : write an email memo and letter. it has to be canadian store or walmart.email - department store constructioninform the
Write a paper on stoicismstoicisms school of hellenistic : write a paper on stoicism.stoicisms school of hellenistic philosophy that was formulated by athens in the third century
Questions on programing problem step 1 we ask you to : questions on programing problem step 1 we ask you to produce a project plan and an interim description of the project
The api for this class ispublic void poweronnbsp sets the : the api for this class ispublic void poweronnbsp sets the machine ready to serve the selected ice creampublic void
Human service interactions in terms of macro : human service interactions in terms of macro systems-communities and organizations.bull describe the concept of
Answer following question1 what are the several fields of : answer following question1. what are the several fields of accounting and how do they differ?2. how are expenses and
Read the case on pricing and production decisions at : read the case on pricing and production decisions at poolvac. inc and answer the questions given below the case. use
Question one-discuss the different types of teams as to : question one-discuss the different types of teams as to their effectiveness that will improve problem solving

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd