Results 1 to 2 of 2
  1. #1
    maggie_2 is offline Member
    Join Date
    Sep 2008
    Posts
    9
    Rep Power
    0

    Default 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");   
     
      }
    
    
    }

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Such question has already took place in the forum i think twoweeks ago,you can search for it,and there you can find a solution.Good luck.

Similar Threads

  1. jsp project help
    By rajibmp in forum New To Java
    Replies: 4
    Last Post: 10-10-2008, 12:50 AM
  2. Could anyone help with project?
    By billdara in forum New To Java
    Replies: 1
    Last Post: 03-12-2008, 05:05 PM
  3. First Project Need Big Help
    By earl in forum New To Java
    Replies: 1
    Last Post: 01-18-2008, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •