Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error ")" ??

Status
Not open for further replies.

pengifyd

Technical User
Mar 8, 2006
3
US
Here is the code that is giving me an error --

if(money > 500)
JOptionPane.showMessageDialog(null, "OK..you win...I owe you $ "money - 500" \n You'll be back!!\n", "MONEY COUNT", JOptionPane.INFORMATION_MESSAGE);

The error is telling me that I need to put ")" in the line (I'm assuming around money since it's a global int), but I don't know where to put it and I'm thinking that I may have written the code wrong as well??

else if(money == 500)
JOptionPane.showMessageDialog(null, "How can you win any money like this??\n We are even!!\n", "MONEY COUNT", JOptionPane.INFORMATION_MESSAGE);

This code of line has no errors


else
JOptionPane.showMessageDialog(null, "HAHAHA..You don't have anymore money!!\n\nYou owe me $ "500 - money" SUCKER!!\n ..and I do take credit cards!!\n", "MONEY COUNT", JOptionPane.INFORMATION_MESSAGE);

Same deal with this one, it's asking me to put " ) " somewhere in the code and I'm not sure where

If anyone could help it would be greatly appreciated :)
 
Well, what you actually need is a better way to concatenante Strings.

Code:
if(money > 500)
   JOptionPane.showMessageDialog(null, "OK..you win...I owe you $ "+(money - 500)+" \n    You'll be back!!\n", "MONEY COUNT", JOptionPane.INFORMATION_MESSAGE);

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top