Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return to main menu

 
Yani Abela
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:


now my problem is that 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
 
Alex Armenteros
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My little advice.


Try encapsulation.

Put every menu inside a function like this
 
Ted Smyth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yani Abela wrote: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.


Hi Yani! When case #6 is selected, you need to break out of that loop (typically by setting your while condition to false, see code snippet below). Without seeing your program I can't guarantee this will work, but likely this is the solution you are looking for. The "Clients" screen is a loop that was accessed from the Main Menu loop, so to return to the first loop, simply break out of the second loop.

 
Yani Abela
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanks for your replies !! they helped a lot and I solved it thanks again!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic