| | |
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: 239 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool linux list loop map method methods mobile netbeans newbie number object oracle os pong print problem producer program programming project projectideas read recursion reflection replaysolutions rim scanner screen server set size sms socket sort sql string swing terminal test threads time transfer tree web windows





