This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Puzzled Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Puzzled" Watch "Puzzled" New topic
Author

Puzzled

Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
I'm writing the assignment Java-4(Say) and I can't get the correct output for nos 11-19, I've got all the rerst to print-out correctly but everytime i try to get 11-19 to printout I can't I've tried an if statement, an if-else statement,a while statemnt and a do-while statment and am running out of ideas. I haven't used a for loop because it doesn't have to loop round
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
Don't Worry I was using wrong operators, I've sorted it out now
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
Post your code using CODE tags and expected output and we can have a look

EDIT: OK...
[ March 29, 2005: Message edited by: Kashif Riaz ]
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
Here' s the program I am using JOptionPane to get the input because I'm using either NetBeans or JCreator
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
I got it wrong. The output is fine if I take out the System.exit(0) for the If statment but if i enter 12 I get
Twelve
Ten
Two
Kareem Qureshi
Ranch Hand

Joined: Mar 14, 2002
Posts: 102
I think your if condition is wrong
it should be if (no >10 && no <20 ) instead of if (no >10 || no >20 )

Hope this helps
Thanks
Kareem
[ March 29, 2005: Message edited by: Kareem Qureshi ]
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
Thank you it works I thoght it had to be something simple but I just couldn't see. Sorry for the late reply but have been busy.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Puzzled
 
Similar Threads
Swimming competition score program
do while loop problem
Time out inside a servlet
from JLS
Question about loops and help