| | |
Java Menu
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 142
Reputation:
Solved Threads: 2
Hi All,
Hoping you can help with the following.
The psuedo code is:
1. Menu is displayed
2. User inputs a selection
3. That item is ran
4. on completion, the user is returned to 1 above.
the code i have so far is as follows, but its still exiting the program.
Hoping you can help with the following.
The psuedo code is:
1. Menu is displayed
2. User inputs a selection
3. That item is ran
4. on completion, the user is returned to 1 above.
the code i have so far is as follows, but its still exiting the program.
Java Syntax (Toggle Plain Text)
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package week7; //import java.io.*; //import java.io.IOException; import java.util.Scanner; /** * * @author Administrator */ public class whileDoTest { public static void main (String[]arguments) { System.out.println("Please make your selection"); System.out.println(""); System.out.println("(1) - New book : (2) - New user : (3) - New Load"); Scanner scan = new Scanner(System.in); int menuSelect = scan.nextInt(); switch (menuSelect) { case 1: menuSelect = 1; System.out.println("Selection 1"); System.out.println("(1) - Main Menu"); menuSelect=0; break; case 2: menuSelect = 2; System.out.println("Selection 2"); break; case 3: System.out.println("Selection 3"); break; } // menuSelect = 0; while (menuSelect > 0 ); } }
•
•
Join Date: Jun 2009
Posts: 142
Reputation:
Solved Threads: 2
0
#3 Nov 2nd, 2009
here it is corrected, but ive made it worse, but hope you can get an idea what im trying to achieve
Java Syntax (Toggle Plain Text)
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package week7; //import java.io.*; //import java.io.IOException; import java.util.Scanner; /** * * @author Administrator */ public class whileDoTest { public static void main (String[]arguments) { System.out.println("Please make your selection"); System.out.println(""); System.out.println("(1) - New book : (2) - New user : (3) - New Load"); Scanner scan = new Scanner(System.in); int menuSelect = scan.nextInt(); switch (menuSelect) { case 1: if(menuSelect ==1) { System.out.println("Selection 1"); System.out.println("(1) - Main Menu"); menuSelect=0; break; } if (menuSelect ==2){ case 2: menuSelect = 2; System.out.println("Selection 2"); break; } case 3: System.out.println("Selection 3"); break; } // menuSelect = 0; while (menuSelect > 0 ); } }
![]() |
Similar Threads
- image slices in java menu (JavaScript / DHTML / AJAX)
- Java Menu with Asp.Net C# Masterpage (JavaScript / DHTML / AJAX)
- JavaScript Menu + vBulletin = Help! (JavaScript / DHTML / AJAX)
- Time Refreshing on a GUI Menu Bar (Java)
- Java Menu Help (Java)
Other Threads in the Java Forum
- Previous Thread: Display Perfect Number
- Next Thread: Need Initials
Views: 238 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android animated api apple applet application arguments array arrays automation binary blackberry block bluetooth chat class classes client code component database detection developmenthelp draw eclipse encode error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie number object online oracle os page print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing template test textfields threads time title transfer tree tutorial-sample update windows working





