I'm supposed to make a menu with choices, the choices being different kinds of java syntax.
import java.util.*;
public class Start
{
public void menu()
{
System.out.println("[1] If\n[2] If else\n[3] For loop\n[4] Switch Statement\n[5] One dimension");
System.out.print("Select program: ");
}
public void backend()
{
System.out.println("[9] Menu\n[0] Quit");
Scanner q = new Scanner(System.in);
switch (q.nextInt())
{
case 0:
System.out.println("End of the program.");
break;
case 9:
new Input();
break;
default:
System.err.println("Please choose the appropriate options.");
break;
}
}
public void ifex()
{
System.out.println("[6] Gender");
Scanner pb = new Scanner(System.in);
switch(pb.nextInt())
{
case 6:
gender();
break;
}
}
public void ifelse()
{
System.out.println("[10] Legal Age");
Scanner gg = new Scanner(System.in);
switch(gg.nextInt())
{
case 10:
break;
}
}
public void gender()
{
System.out.println("Choose your gender\n[7] Male\n[8] Female");
Scanner gb = new Scanner(System.in);
switch(gb.nextInt())
{
case 7:
System.out.println("Your gender is Male");
new backend();
break;
case 8:
System.out.println("Your gender is Female");
new backend();
break;
default:
System.err.println("That is not on the options. Please try again.");
break;
}
}
public void age()
{
System.out.println("Enter your age");
Scanner gb = new Scanner(System.in);
Int age = input.nextInt();
if (age < 12);
System.out.println("You are not yet in a legal age.");
System.out.println("You are in a legal age");
backend();
break;
}
}
public Start()
{
Scanner in = new Scanner(System.in);
menu();
switch (in.nextInt())
{
case 1:
ifex();
break;
case 2:
ifelse();
break;
}
}
public static void main (String[]args)
{
new Start();
}
}