Post: Java Programming Looping
03-12-2011, 09:46 PM #1
IKILLU2014
Toaster...
(adsbygoogle = window.adsbygoogle || []).push({}); So i am just starting to learn java, and i made a pretty good calculator all by myself with no tuts, just the code and the definition of what it does, but i cannot figure out how to make it look to the beginning after i am finished, so i do not have to restart it each time. Does anyone know?
(adsbygoogle = window.adsbygoogle || []).push({});
03-15-2011, 03:53 AM #11
DeLeTeD
Maggbot timeout!
yea try something like


int repeat;
do{
your calc code

Output, would you like to continue yes [1] or no [0]
user enters value for repeat
}while(repeat.equals(1));


Now you can enter as many as you want instead of 3. It is fairly simple.

You loop through the first time, at the end the user enters a value for repeat. If it equals one then repeat again. You can use a char or a string, and get more advanced with something like

repeat = repeat.toLowerCase();


(I hate java btw :()
03-15-2011, 11:05 PM #12
kiwimoosical
Bounty hunter
Originally posted by DeLeTeD View Post
right and wrong. If your using a loop like his case you want it to run at least once do a do while is better for loading. I know the difference is not much and your method still works however getting use to the proper format and use of codes will help in the long run.


I know, just didn't feel like typing it all out.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo