Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-05-2008, 01:01 AM
Member
 
Join Date: Dec 2008
Posts: 2
Rep Power: 0
TeeTee123 is on a distinguished road
Default Really need Help
Please Help,
I’m trying to setup an application that allows a user to build an ice cream cone, I managed to get the Exception file to compile, but the IceCreamCone file gives me the following error message when I try to compile, I think the problem is in the exception file constructor but not sure how to fix:

IceCreamCone.java:16: cannot find symbol
symbol : constructor IceCreamConeException()
location: class IceCreamConeException
throw(new IceCreamConeException());
^
1 error

Can anyone tell me what I am not seeing, I don’t have a lot of experience and in desperate need of guidance.



Code:
public class IceCreamConeException extends Exception
{

  int scoops, scps;
  String flavor,flav;

 public IceCreamConeException(String flavor, int scoops)
 {

   flavor = flav;
   scoops = scps;

 }


} 
   


import javax.swing.*;

 public class IceCreamCone
 {

   private String flavor;
   private int scoops;

   public static int SCOOP_LIMIT = 3;
   public IceCreamCone(String flav, int scps) throws IceCreamConeException
   {

     flavor = flav;
     scoops = scps;
     if(scoops > SCOOP_LIMIT)
        throw(new IceCreamConeException());

   }



}  




import javax.swing.*;

import javax.swing.*;

 public class ThrowIceCreamCone
 {

   public static void main(String[] args)
   {

     int scps;
     string flav;
     String input;

   
   flav = input;

   public ThrowIceCreamCone()


   {

      setFlavor();
      setScoops();

   }


input = JOptionPane.showInputDialog(null, "How many scoops of ice cream would you like?");
   scps = Integer.parseInt(input);

   input = JOptionPane.showInputDialog(null, "what flavor of ice cream would you like?");




  try
  {

     IceCreamCone ic = new IceCreamCone(flav, scoops);
      
     JOptionPane.showMessageDialog(null, "Your ice cream flavor is" + flav + " and has " + scoops + "scoops");

  }


  catch(IceCreamConeException exception)
  {

     JOptionPane.showMessageDialog(null, exception.getMessage());

  }


}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 12-05-2008, 03:50 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 6,523
Rep Power: 9
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Quite same question have discuss several times on our community. May be all are from the same class, everyone get the same assignment.

You get the error on this line,

Code:
throw(new IceCreamConeException());
saying that you don't have that constructor in your relevant class. Basically you don't have define the default constructor. If you define non-default constructor in a class VM not automatically call the default constructor. You must define it if you want to use.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-05-2008, 07:09 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 571
Rep Power: 2
fishtoprecords is on a distinguished road
Default
As a smart person says: Use an appropriate Subject. "Help, urgent!" isn't one.

"really need help" is another example of an inappropriate and useless subject
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-05-2008, 06:46 PM
Member
 
Join Date: Dec 2008
Posts: 2
Rep Power: 0
TeeTee123 is on a distinguished road
Default
What????????????
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-05-2008, 06:49 PM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 3,190
Rep Power: 5
Fubarable is on a distinguished road
Default
The title of your thread here is your best way of broadcasting to us just what your problem is, kind of like the headline of a newspaper. Just as if you create a decent and informative newspaper headline, more people will read the article, if you create a decent and informative Thread subject heading more people will read your thread and help you.

Which do you think is more informative, this?
"Error when throwing exception"

or this?
"Really need help"
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-08-2008, 10:14 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 6,523
Rep Power: 9
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by TeeTee123 View Post
What????????????
Just look at my signature, may be fishtoprecords pointed on that.

And also, don't keep quite. If you have found the solution better to mention here. Seems you are not even look at the thread for a long time.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 12-08-2008, 06:06 PM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 571
Rep Power: 2
fishtoprecords is on a distinguished road
Default
Originally Posted by Eranga View Post
Just look at my signature, may be fishtoprecords pointed on that.
Not "may be" but for sure.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 12-09-2008, 05:12 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 6,523
Rep Power: 9
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by fishtoprecords View Post
Not "may be" but for sure.
Someone can say that before me. Because I heard it from one of my University lecturers.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +2. The time now is 02:21 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org