Delete Post!
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Delete Post!
Last edited by OOO; April 25th, 2011 at 03:10 PM.
Hi,
This one is subtle and took me a minute or two of looking.
There is a difference between
i=+10 // Assigns the value 10 to i == (i = 10)
and
i += 10 // increments by 10
This is the reason for the infinite loop.
There is another bug with the program regarding the termination point.
Suisse
OOO (April 2nd, 2011)
Delete Post!
Last edited by OOO; April 25th, 2011 at 03:04 PM.
Delete Post!
Last edited by OOO; April 25th, 2011 at 03:04 PM.
Sorry I think I might have confused you. I mean that the for loop will terminate early the way you have written it.
Have you Ran it since correcting the other issue?
INPUT
Please Enter Treadmill Type:
a
Please Enter Number of Minutes X:
40
OUTPUT
Calories burned after 10 minutes : 39
Calories burned after 20 minutes : 78
Calories burned after 30 minutes : 117
Your current for loop doesn't continue until 40.
I am not trying to be difficult, but debugging skills are very important. Do you use an IDE or run the program from the command line?
Suisse
hi,
im sorry for an interruption here in your post. Actually i wanted to post a new thread. and after i sign in and go to new posts , i dont find an option "post a new thread" anywhere .. could you please help me with that and where exactly i can do that..
Thank you in advance ..