In: Computer Science
Java
Create a method to display a menu. When this method is called it should receive the user's name, great the user, and ask them to make a selection. 1 - Change your name, 2 - Test your IQ, 3 - Display a table, 4 - Play a game, 5 - Exit.
import java.util.Scanner;
public class Menu {
public static void main(String[] args) {
int ch=displayMenu("Uday");
}
private static int displayMenu(String name) {
System.out.println("Welcome
"+name+" ....!!!");
System.out.println("1 - Change your
name, \n2 - Test your IQ, \n3 - Display a table, \n4 - Play a game,
\n5 - Exit.");
Scanner sc = new
Scanner(System.in);
int ch=sc.nextInt();
return ch;
}
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me