problem with my project

Other related stuff

problem with my project

Unread postby kokilasoral » 04 Jun 2016, 05:29

If somebody could help me better understand what the book needs me to do I would really appreciate it. Ive done a little of the classes but I don't finish like they are correct or I am exploit them right.

This is the projects description:

A. Create an Ice Cream ConeException class whose constructor obtains a String that consists of an ice cream cone’s flavor and an integer on behalf of the number of revelations in the IceCream Cone. Pass this String to the Ice Cream ConeException parent so it can be charity in a get Message () call. Save the class as IceCream Cone Exception.java. Create an Ice cream Cone class with 2 fields—flavor and scoops. The Ice Cream Cone constructor calls two data-entry methods—set Flavor () and set Scoops(). The setb Scoops () method throws an Ice Cream ConeException when the scoop amount exceeds three. Save the class as IceCreamCone.java. Write an application that founds several Ice Cream Cone objects and knobs the Exceptions. Save the file as Throw IceCream.java.

So distant this is what I have done for Ice Cream ConeException:

public class Ice CreamConeException
{
private String cream Flavor;
private int scoops;

public Ice CreamConeException(String flavor, int num Scoops)
{
Cream Flavor = flavor;
scoops = num Scoops;
}
}

and for the Ice CreamCone:

import javax.swing.*;
public class Ice CreamCone
{
protected String[] cream Flavors = {"Chocolate", "Cookies and Cream",
"Vanilla", "Strawberry", "Banana", "Pistachio", "Butterscotch"};
private String menu = "";
private int choice;
private int scoops;

public String display Menu()
{
for(int x = 0; x < creamFlavors.length; ++x)
{
menu = menu + "\n" + (x + 1) + " for " +
cream Flavors[x];
}
String input = JOptionPane. showInputDialog(null,
"Make your selection. Then hit enter." + menu);
choice = Integer. parseInt(input);
return(cream Flavors[choice - 1]);
}
}
kokilasoral
 
Posts: 2
Joined: 03 Jun 2016, 12:07
Has thanked: 0 time
Been thanked: 0 time

Return to Off Topic

Who is online

Users browsing this forum: No registered users and 2 guests