473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

java simple user menu

65
Hi all,

im attempting to make a user menu, which the user instigates the exit, not netbeans.

basically i want a menu displayed,
user makes selection,
that specific piece is ran,
on completion the user is returned to the main menu.

The following is my attempt, however its not doing what i need. i get no errors

Expand|Select|Wrap|Line Numbers
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package week7;
  7. //import java.io.*;
  8. //import java.io.IOException;
  9. import java.util.Scanner;
  10. /**
  11.  *
  12.  * @author Administrator
  13.  */
  14. public class whileDoTest {
  15.  
  16.     @SuppressWarnings("empty-statement")
  17.     public static void main (String[]arguments)
  18.     {
  19.  
  20.         int menuSelect = 0;
  21.        if (menuSelect ==0){
  22.             System.out.println("Please make your selection");
  23.             System.out.println("");
  24.             System.out.println("(1) - New book     :     (2) - New user     :     (3) - New Load");
  25.             Scanner scan = new Scanner(System.in);
  26.             menuSelect = scan.nextInt();
  27.        }else{
  28.             switch (menuSelect)
  29.             {
  30.                 case 1:
  31.                    if(menuSelect == 1) {
  32.                     System.out.println("Selection 1");
  33.                     System.out.println("(1) - Main Menu");
  34.  
  35.                     break;
  36.                    }menuSelect = 0;
  37.                 case 2:
  38.                     if(menuSelect ==2) {
  39.                     System.out.println("Selection 2");
  40.                     break;
  41.                     }
  42.                 case 3:
  43.                     if (menuSelect ==3){
  44.                     System.out.println("Selection 3");
  45.                     break;
  46.                     }
  47.  
  48.  
  49.             }
  50.  
  51.             }
  52.     }
  53. }
  54.  
  55.  
  56.  
Nov 2 '09 #1
1 4972
whitep8
65
also, i removed the break from the cases, and remove the else if
Nov 2 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Striped | last post by:
What's wrong with the context menu? I have created one for the DataGrid control and showing it like this: private void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {...
3
by: trint | last post by:
My boss wants this web app that I'm developing to have a java like dropdown menu. Is that possible with c# .Net? I haven't been able to find anything like that? Any help is appreciated. Thanks,...
3
by: 42 | last post by:
Hi, I've run into a block, that I'm almost sure is really simple...but I can't seem to clue in right now. I'd like to create a user control that takes input like this: <mycontrol:panel...
5
by: VB Programmer | last post by:
I create a simple user control and exposed a property, "MyProperty". I dragged it onto a new webform. I want to access the exposed property ("MyProperty") of the user control. But, I cannot...
6
by: yefei | last post by:
i want to display a price lists according to the product groups the user select. the designer gave to me is to show the product groups use a tab menu, which can enlarge a little bit, when user...
0
by: | last post by:
I have a simple USer control Page and web form . I added a label into my ascx file wich has "Label" text as default. When i try to change its value in my ascx file's page_load event ...
4
by: mattmao | last post by:
Greetings everyone. I am a college student studying in the University of Technology, Sydney. PHP is not in my studying plan, I am taking subjects about J2EE in this semester. However I do...
4
by: john23 | last post by:
Good morning. I am attempting to utilize a simple css image swap menu, which appears to be working as planned in IE, however, it is not lining up correctly in FireFox and Opera. Please view...
1
by: rooky13 | last post by:
I am working on an assignment for my class (don't worry you're not doing my homework for me). I want to have a method that asks the user a yes/no question specifically "did you pay due?" but the way...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.