Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > What's wrong with this Java code?...
Pages (2): [1] 2 »   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
Turbonium
Supreme tranceaddict



Registered: Jan 2003
Location: Toronto
What's wrong with this Java code?...

code:
import java.applet.*; import java.awt.*; import java.awt.event.*; public class Freddie extends Applet implements ItemListener { int sandwiches = 0; String fCode="", dCode="", cCode=""; Label sandwichPromptLabel = new Label("Number of sandwiches ordered:"); TextField sandwichInputField = new TextField(5); Label friesLabel = new Label("Fries serving size: "); CheckboxGroup friesGroup = new CheckboxGroup(); Checkbox smallFries = new Checkbox("Small",false,friesGroup); Checkbox mediumFries = new Checkbox("Medium",false,friesGroup); Checkbox largeFries = new Checkbox("Large",false,friesGroup); Label drinkLabel = new Label("Drink serving size: "); CheckboxGroup drinkGroup = new CheckboxGroup(); Checkbox smallDrink = new Checkbox("Small",false,drinkGroup); Checkbox mediumDrink = new Checkbox("Medium",false,drinkGroup); Checkbox largeDrink = new Checkbox("Large",false,drinkGroup); Label condimentsLabel = new Label(" Condiments: "); Checkbox catsupBox = new Checkbox("Catsup"); Checkbox mustardBox = new Checkbox("Mustard"); Checkbox picklesBox = new Checkbox("Pickles"); Label outputLabelSandwiches = new Label(""); Label outputLabelDrink = new Label(""); Label outputLabelFries = new Label(""); Label outputLabelCondiments = new Label(""); Label warningLabel = new Label(""); public void init() { setBackground(Color.red); add(sandwichPromptLabel); add(sandwichInputField); sandwichInputField.requestFocus(); add(friesLabel); add(smallFries); smallFries.addItemListener(this); add(mediumFries); mediumFries.addItemListener(this); add(largeFries); largeFries.addItemListener(this); add(drinkLabel); add(smallDrink); smallDrink.addItemListener(this); add(mediumDrink); mediumDrink.addItemListener(this); add(largeDrink); largeDrink.addItemListener(this); add(condimentsLabel); add(catsupBox); catsupBox.addItemListener(this); add(mustardBox); mustardBox.addItemListener(this); add(picklesBox); picklesBox.addItemListener(this); add(outputLabelSandwiches); add(outputLabelFries); add(outputLabelDrink); add(outputLabelCondiments); add(warningLabel); } //This method is triggered by the user clicking an option button public void itemStateChanged(ItemEvent choice) { try { sandwiches = getSandwiches(0); fCode = getFries(""); dCode = getDrink(""); cCode = getCondiments(""); sendOutput(sandwiches,fCode,dCode,cCode); <<<<< cannot resolve symbol } catch (NumberFormatException e) { warningLabel.setText("You must enter an integer value."); sandwichPromptLabel.setText(""); sandwichPromptLabel.requestFocus(); } } public int getSandwiches(int sandwiches) { sandwiches = Integer.parseInt(sandwichInputField.getText()); return sandwiches; } public String getFries(String fCode) { fCode = ""; if (smallFries.getState()) fCode = "Small"; else if (mediumFries.getState()) fCode = "Medium"; else if (largeFries.getState()) fCode = "Large"; return fCode; } public String getDrink(String dCode) { dCode = ""; if (smallDrink.getState()) dCode = "Small"; else if (mediumDrink.getState()) dCode = "Medium"; else if (largeDrink.getState()) dCode = "Large"; return dCode; } public String getCondiments(String cCode) { cCode = ""; if (catsupBox.getState()) cCode = "1"; else if (mustardBox.getState()) cCode = "2"; else if (picklesBox.getState()) cCode = "3"; return cCode; } public void int String sendOutput(int sandwiches, String fCode, String dCode, String cCode) { outputLabelSandwiches.setText("# of sandwiches ordered: " + sandwiches); outputLabelFries.setText("Size of fries ordered: " + fCode); outputLabelDrink.setText("Size of drink ordered: " + dCode); outputLabelCondiments.setText("Condiments ordered: " + cCode); } } <<<<< '(' expected




compiler errors are bolded in orange and described

Last edited by Turbonium on Apr-29-2004 at 21:19

Old Post Apr-29-2004 21:10  Canada
Click Here to See the Profile for Turbonium Click here to Send Turbonium a Private Message Add Turbonium to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Azz3D
Asobi Seksu'd



Registered: Jul 2002
Location:

I don't know anything about java, but just a thought:

to make it easier to read use the [.code] tag. it lines up the brackets and makes the spacings look like on the compiler...


___________________
Summary of an ASOT episode:

- The newest tunes selected!!!! the hottest tracks in a row!!!! here is your host arrrrrmin van buuuuuuuuhreeennnnnhnnhhn
- hello and welcome glad u cud join us this is a state of trance episode blah blah blah
- waaaaaaaaaaaaaaaaaaah waaaaaaaaaaaaah whineeeeeeeeeeeee blah blaaaaaaaaah
- that was the newest track by blah bla and before that was blaaaaaaah
- waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa....the end

Vomit-inducing trifecta tunage: Zocalo | Summer Dream | Shivers

Old Post Apr-29-2004 21:15  Yugoslavia
Click Here to See the Profile for Azz3D Click here to Send Azz3D a Private Message Add Azz3D to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Turbonium
Supreme tranceaddict



Registered: Jan 2003
Location: Toronto

quote:
Originally posted by Azz3D
I don't know anything about java, but just a thought:

to make it easier to read use the [.code] tag. it lines up the brackets and makes the spacings look like on the compiler...

Yea, it definitely needed that. Thanks.

Old Post Apr-29-2004 21:18  Canada
Click Here to See the Profile for Turbonium Click here to Send Turbonium a Private Message Add Turbonium to your buddy list Report this Post Reply w/Quote Edit/Delete Message
whiskers
old skool



Registered: Sep 2001
Location: in your dreams

well, what kind of sandwiches are you trying to send?


___________________

Old Post Apr-29-2004 21:19  Ukraine
Click Here to See the Profile for whiskers Click here to Send whiskers a Private Message Add whiskers to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Turbonium
Supreme tranceaddict



Registered: Jan 2003
Location: Toronto

quote:
Originally posted by whiskers
well, what kind of sandwiches are you trying to send?

integer value ones, you dumbass

go back to programming class you n00b!

Old Post Apr-29-2004 21:20  Canada
Click Here to See the Profile for Turbonium Click here to Send Turbonium a Private Message Add Turbonium to your buddy list Report this Post Reply w/Quote Edit/Delete Message
whiskers
old skool



Registered: Sep 2001
Location: in your dreams

quote:
Originally posted by Turbonium
integer value ones, you dumbass




there's your problem, your sandwiches don't have any cheese in them, how can you have sandwiches without any cheese?


___________________

Old Post Apr-29-2004 21:28  Ukraine
Click Here to See the Profile for whiskers Click here to Send whiskers a Private Message Add whiskers to your buddy list Report this Post Reply w/Quote Edit/Delete Message
nchs09
Traceaddict in training



Registered: Sep 2003
Location: Inside your mum

quote:
Originally posted by whiskers
there's your problem, your sandwiches don't have any cheese in them, how can you have sandwiches without any cheese?
ya DUH! sandwhich with out cheese. suckz0r!


___________________
quote:
Originally posted by Halcyon+On+On
OOKA-OOKA ME NACHOS ME PRESS KEYS ON COMPUTER GOOD

Old Post Apr-29-2004 21:28 
Click Here to See the Profile for nchs09 Click here to Send nchs09 a Private Message Add nchs09 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
igottaknow
PerfectTeeth R4 Dinosaurs



Registered: Feb 2001
Location: The Future

all this programming talk making me hungry...

while your at it would you mind sending me an italian assorted with the works thanks in advance


___________________
GIGANTIC CUNT

Old Post Apr-29-2004 21:40 
Click Here to See the Profile for igottaknow Click here to Send igottaknow a Private Message Add igottaknow to your buddy list Report this Post Reply w/Quote Edit/Delete Message
GQMr2
Supreme tranceaddict



Registered: Nov 2002
Location: Zoo York, NY

haha I haven't programmed since highschool on Macintosh


___________________
http://vandiemen.mypodcast.com
lf a desire which no experience in this world can satisfy, the most probable explanation is that I was made for another world." - C.S.Lewis

"everything is within walking distance, if you have the time." - Steven Wright

Old Post Apr-29-2004 21:41  Romania
Click Here to See the Profile for GQMr2 Click here to Send GQMr2 a Private Message Visit GQMr2's homepage! Add GQMr2 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
mezzir
BEES?



Registered: Nov 2002
Location: assachusetts

yo i swear you need curly brackets to do if statements
so like instead of
if (smallFries.getState()) fCode = "Small";

else
....
return fCode;


you'd do:
if (smallFries.getState())//*is this a boolean?*/{ /* <-- { = then
fCode = "Small"
}else{
......
return fCode;
}


___________________

http://www.youtube.com/mezzir

Old Post Apr-29-2004 22:38  Niue
Click Here to See the Profile for mezzir Click here to Send mezzir a Private Message Add mezzir to your buddy list Report this Post Reply w/Quote Edit/Delete Message
loconet
de la puta madre!



Registered: Jul 2002
Location: San Francisco

code:
public void int String sendOutput(int sandwiches, String fCode, String dCode, String cCode)



dude, wtf? 3 return types? Stick with one - in this case probably void


___________________
[alk]

Old Post Apr-29-2004 22:49  Peru
Click Here to See the Profile for loconet Click here to Send loconet a Private Message Visit loconet's homepage! Add loconet to your buddy list Report this Post Reply w/Quote Edit/Delete Message
mezzir
BEES?



Registered: Nov 2002
Location: assachusetts

quote:
Originally posted by loconet
code:
public void int String sendOutput(int sandwiches, String fCode, String dCode, String cCode)



dude, wtf? 3 return types? Stick with one - in this case probably void

wow i completely missed that
that should take care of the parenthases problem i think?
but still the cannot resolve symbol
this is gonna annoy me


___________________

http://www.youtube.com/mezzir

Old Post Apr-29-2004 23:25  Niue
Click Here to See the Profile for mezzir Click here to Send mezzir a Private Message Add mezzir to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > What's wrong with this Java code?...
Post New Thread    Post A Reply

Pages (2): [1] 2 »  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackSample ID, "Circuits Activated" [2002] [2]

Click here to listen to the sample!Pause playbackK-Lab - The Voice Of Truth (Basement Mix) [2003]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 22:43.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!