dhust
2/11/2014 - 2:37 AM

Menu Example

Menu Example

public static void main(String[] args) {

	// Variables
	Scanner input = new Scanner(System.in);
	byte userChoice;

	// Menu
	System.out.println("MENU");
	System.out.println("Choose 1 for Dave");
	System.out.println("Choose 2 for Melissa");
	System.out.println("Choose 3 for Adam");
	System.out.println("Choose 4 for Landon");
	System.out.print("What's your choice: ");

	// Get user response
	userChoice = input.nextByte();

	// The print statement below was used to check how well 
	// the program was working up to that point
	/* System.out.print("You chose " + userChoice); */

	if (userChoice == 1) {
		System.out.println("Please leave a message for Dave.");
	}
	else if (userChoice == 2) {
		System.out.println("Please leave a message for Melissa.");
	}
	else if (userChoice == 3) {
		System.out.println("Please leave a message for Adam.");
	}
	else if (userChoice == 4) {
		System.out.println("Please leave a message for Landon.");
	}
	else {
		System.out.println("Not a valid input!");
	}

}