I am trying to figure out how to restart a program after I have already run through it. For instance, Would the user like to start over again, where should I place this code and should I use a Loop of some sort Thanks Jpre
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
I think you need to provide more info to get this answered. Is it a GUI? How is it started? What does it do?
jp staff
Greenhorn
Joined: Sep 10, 2001
Posts: 5
posted
0
He is my code in a nutshell, after it goes through everything I want to beable to ask the user if it would like to go through the process again
[This message has been edited by Cindy Glass (edited September 12, 2001).]
Dave Vick
Ranch Hand
Joined: May 10, 2001
Posts: 3244
posted
0
JP Just put the entire working part of the main in a loop. Here it is in a do loop:
you'll need to declare the int variable doOver in the code above where the loop starts. One point though, from a design stand point. You're collecting the information from the user in inputDialogs but then you show the results on the command line. That is a little hard to follow and some users might get confused. It might be better to do it all one way or the other - all on the command line or all with dialog boxes. hope that helps you out ------------------ Dave Sun Certified Programmer for the Java� 2 Platform [This message has been edited by Dave Vick (edited September 10, 2001).]
Dave
jp staff
Greenhorn
Joined: Sep 10, 2001
Posts: 5
posted
0
Thanks dave that helps me out a lot, I am very new to java, and still think in terms of c, to take input from the command line from the user, How do I do that. My book dosen't go into to much detail. Thanks Jp
Dave Vick
Ranch Hand
Joined: May 10, 2001
Posts: 3244
posted
0
JP Here this should give you good start on it. declare this before the actual loop: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); At the bottom of the loop, instead of the dialog use this:
If you need more let me know
------------------ Dave Sun Certified Programmer for the Java� 2 Platform
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.