View Single Post
  #2 (permalink)  
Old 07-19-2007, 08:33 PM
cruxblack cruxblack is offline
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Code:
if (dollars[200]){
The input u giv for the if statement was supposed to be boolean, u can't use an int type and hope that it'll turn out into a boolean like in C++, in Java it's either gotta be true or false, and since u didn't enter a logical expression that can return a boolean type or use a boolean type instead in da input, da error occured

Bout how to fix it, try this

Code:
result = input / dollars[ctr]; if (input>=dollars[1]) { System.out.println(dollars[ctr] + " coins " + result); } else { System.out.println(dollars[ctr] + " cents coins " + result); } input = input % dollars[ctr];
that should at least give u an output like this

Code:
Input Integer: 572 200 coins 2 100 coins 1 50 cents coins 1 20 cents coins 1 1 cents coins 2
bout da $ mark to replace 200 into $2, u could use some of da printing editor class, or maybe use some REGEX expression, ill look into it and post it later

good luck
Reply With Quote