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

Annoying Problem.

Stephen Foy
Ranch Hand

Joined: Oct 17, 2005
Posts: 143
I can seem to sort this out, the program should print out a different result for 1, but it keeps printing 2 1's

http://img481.imageshack.us/img481/5180/untitled5ar.jpg
[ October 28, 2005: Message edited by: ste fing ]

Stephen Foy - Microsoft Application Development Consultant
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3739
    
  16
Try stepping through the code - either with a debugger or pen and paper

Assume number = 5.
Enter do/while loop
number = number - 2 ==> number = 3
print verse (number = 3)
while condition (number < 100 && number > 1) ==> true
repeat loop
number = number - 2 ==> number = 1
print verse (number = 1)
while condition (number < 100 && number > 1) ==> false
exit loop
print final verse (number = 1)


Joanne
Stephen Foy
Ranch Hand

Joined: Oct 17, 2005
Posts: 143
Originally posted by Joanne Neal:
Try stepping through the code - either with a debugger or pen and paper

Assume number = 5.
Enter do/while loop
number = number - 2 ==> number = 3
print verse (number = 3)
while condition (number < 100 && number > 1) ==> true
repeat loop
number = number - 2 ==> number = 1
print verse (number = 1)
while condition (number < 100 && number > 1) ==> false
exit loop
print final verse (number = 1)


Yea that does help, I should have done that. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Annoying Problem.