aspose file tools*
The moose likes Beginning Java and the fly likes Need help with code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help with code" Watch "Need help with code" New topic
Author

Need help with code

Ron Khoe
Greenhorn

Joined: Sep 06, 2008
Posts: 3
Hello,
I need help with a project I am working on for school, what I need to do is create an application that helps a user select an ice cream cone flavor and how many scoops on the come. I managed to get the IceCreamconeException file to compile, however, I get error messages that states that an identifier is expected on about five lines when I try to compile the IceCreamCone file.Can anyone tell me exactly what this error message means. Any and all suggestions would be greatly appreciated, here are the error messages:

C:\Users\Owner\Documents\213191d_Ch15\Chapter.15>javac IceCreamCone.java
IceCreamCone.java:28: <identifier> expected
inputString = JOptionPane.showInputDialog(null, "What flavor of ice cream wou
ld you like?");
^
IceCreamCone.java:29: <identifier> expected
flavor = inputString;
^
IceCreamCone.java:32: <identifier> expected
inputString = JOptionPane.showInputDialog(null, "How many scoops of ice crea
m woul you like on your cone?");
^
IceCreamCone.java:33: <identifier> expected
scoops = Integer.parseInt(inputString);
^
IceCreamCone.java:36: illegal start of type
try
^
IceCreamCone.java:56: <identifier> expected
JOptionPane.showMessageDialog(null, "You chose" + flavor + "with" + scoops +
"of ice cream");

^
6 errors


[edit]Delete excess blank lines. CR[/edit]
[ December 03, 2008: Message edited by: Campbell Ritchie ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
those lines need to be inside a method (or constructor),
not dangling out amongst the class fields
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
You appear not to have taken note of what I told you yesterday about the setScoops method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with code