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.

/*
 * 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 );
            }

    }

here it is corrected, but ive made it worse, but hope you can get an idea what im trying to achieve

/*
 * 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 );
            }

    }

im going to close and re-open as i made a stupid mistake on the first post

This question has already been answered. Start a new discussion instead.