Results 1 to 2 of 2
Thread: Need Help With Project
- 12-02-2008, 06:35 AM #1
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
Need Help With Project
Hello,
I am working on a project for school and am having trouble getting started. I have to create a application that helps a user build an ice cream cone. I am currently working on the first two files, I just want someone to tell me if I am heading in the right direction as far as putting these first two files together. The instructions tell me to create an IceCreamConeException class whose constructor receives a String that consists of an ice cream cone's flavor and an integer representing the number of scoopsin the IceCreamCone. Pass the String to the IceCreamConeException's parent so it can be used in a get Message() call. In the IceCreamCone file I must create two fields flavor & scoops, the IceCreamCone constructor must call two data entry methods setFlavor() & setScoops(). The setScoops() method must throw an exception when scoop quantity exceeds three. Any suggestions or comments would be greatly appreciated.
Java Code:public class IceCreamConeException extends Exception { int scoops, scps; String flav; public IceCreamConeException(String flavor) { flav = flavor; scps = scoops; } } import javax.swing.*; public class IceCreamCone { String flavor; int scoops; public IceCreamCone() { setFlavor(); setScoops(); } void setScoops() throws IceCreamConeException { if(scoops > 3) throw (new IceCreamConeException()); JOptionPane.showMessageDialog(null, "You are only allowed a maximum of three scoops"); } }
- 12-02-2008, 08:24 AM #2
Similar Threads
-
jsp project help
By rajibmp in forum New To JavaReplies: 4Last Post: 10-10-2008, 12:50 AM -
Could anyone help with project?
By billdara in forum New To JavaReplies: 1Last Post: 03-12-2008, 05:05 PM -
First Project Need Big Help
By earl in forum New To JavaReplies: 1Last Post: 01-18-2008, 06:12 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks