This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes back to main menu. Help!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

back to main menu. Help!!

Yani Abela
Greenhorn

Joined: Jan 30, 2012
Posts: 17
hi there
I am currently doing a DVD Rental System that when the user runs the program, he gets to choose from the menus. My problem is that when the user enters a menu and customizes for example a client, I don't know how to go back for the main menu. This is what I have done so far;

This is the main menu ;



Then the user chooses for example the number 1 (Clients) and the following menu is then shown:



I don't know what do I have to write in case 6 so that the main menu will be shown again. Can somebody please help?? Thanks
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Let's call what you've written so far, menu(). The purpose of menu() is to get the user's input to control program flow. Any time you want to get the user's input, you'd call method menu() and either get the user's menu choice in an instance variable or have the method menu() return the user's choice as a token of some kind. Since you have multiple menus (apparently), and I don't know what those look like, I'm not sure how those will work in, but you could use the same kind of control as suggested below, but have different menu() methods that change different usersChoice variables.

Then, a general form of your program could be (there are many other possibilities, this is a suggestion):



Write your menu design down on paper, code a small parts of it, starting with a main() method that compiles and runs, then compile/test/fix/validate/repeat, and come back when you need help.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Please UseOneThreadPerQuestion

Continue in http://www.coderanch.com/t/566407/java/java/return-main-menu . I'm closing this thread.


luck, db
There are no new questions, but there may be new answers.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: back to main menu. Help!!
 
Similar Threads
Conversion help plz!!!
Something i'm extremely confused on
shell sort
TCP Threaded Server Client Question
return to main menu