I'm not sure how strict your instructor is, because you're not following the menu model already laid out where you are supposed to be getting input in the form of char's - not ints(ie: Enter 1, 2, 3, or 4 etc). Once you fix that, put this user interface into it's own class UserInterface from where you can easily instantiate it into a loop. Think about your assignment from a design perspective and not from a programming perspective when you begin, what classes have you considered for the items available from the menu? What values are you intending to keep track of and calculate? You might want to think about three separate classes for the different sub menu's data.
I changed the code a bit simply for viewing purposes, I found all those System.out.println's to be ugly - but that's just me. Just posting this in case you wanted to use it, you don't have to.
Keep going - you can do this.
public class Catering {
public static void main(String[] args) {
UserInterface ui = new UserInterface();
while (true) {
ui.menu();
}
}
}
import java.util.Scanner;
public class UserInterface {
public void menu() {
int a, b;
String number;
Scanner input = new Scanner(System.in);
System.out.print(
"\t\t+========================= ======================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t1 - Order Module\n" +
"\t\t2 - Payment Module\n" +
"\t\t3 - Report Module\n" +
"\t\t4 - Quit the program\n\n" +
"\t\tEnter 1,2,3 or 4 to make a selection: ");
number = input.nextLine();
a = number.charAt(0);
b = number.charAt(0);
switch (a) {
case '0':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t1 - Order Module\n" +
"\t\t2 - Payment Module\n" +
"\t\t3 - Report Module\n" +
"\t\t4 - Quit the program\n\n" +
"\t\tEnter 1,2,3 or 4 to make a selection: ");
number = input.nextLine();
break;
case '1':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t\t\tORDER MODULE\n" +
"\t\t5 - to place orders for food\n" +
"\t\t6 - to place orders for other services\n" +
"\t\t0 - to return to Main Menu\n" +
"\t\t4 - Quit the program\n\n" +
"\t\tEnter 5,6,0 or 4 to make a selection: ");
number = input.nextLine();
break;
case '2':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tPAYMENT MODULE\n" +
"\t\t7 - to display total amount to be paid\n" +
"\t\t8 - to make payment\n" +
"\t\t0 - to return to Main Menu\n" +
"\t\t4 - Quit the program\n\n" +
"\t\tEnter 7,8,0 or 4 to make a selection: ");
number = input.nextLine();
break;
case '3':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tREPORT MODULE\n" +
"\t\t9- to display the invoice for order made\n" +
"\t\t10 - display the summary of orders and payments made\n" +
"\t\tO - to return to Main Menu\n" +
"\t\t4 - Quit the program\n" +
"\t\tEnter 9,10,0 or 4 to make a selection: ");
number = input.nextLine();
break;
}
switch (b) {
case '0':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t1 - Order Module\n" +
"\t\t2 - Payment Module\n" +
"\t\t3 - Report Module\n" +
"\t\t4 - Quit the program\n\n" +
"\t\tEnter 1,2,3 or 4 to make a selection: ");
number = input.nextLine();
break;
case '5':
System.out.print(
"\t\t+===================== ==========================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t\t\tORDER MODULE\n" +
"\t\t place orders for food\n");
number = input.nextLine();
break;
case'6':
System.out.print(
"\t\t+========================= ======================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n" +
"\t\t\t\tORDER MODULE\n" +
"\t\tplace orders for other services\n");
number = input.nextLine();
break;
case'7':
System.out.print(
"\t\t+========================= ======================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tPAYMENT MODULE\n" +
"\t\ttotal amount to be paid\n");
number = input.nextLine();
break;
case'8':
System.out.print(
"\t\t+========================= ======================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tPAYMENT MODULE\n" +
"\t\tto make payment\n");
number = input.nextLine();
break;
case'9':
System.out.print(
"\t\t+========================= ======================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tREPORT MODULE\n" +
"\t\tdisplay the invoice for order made\n");
number = input.nextLine();
break;
case'1':
System.out.print(
"\t\t+================= ==============================+\n" +
"\t\t| *** *** |\n" +
"\t\t| *** EVENT MANAGEMENT SYSTEM *** |\n" +
"\t\t| *** *** |\n" +
"\t\t+========================= ======================+\n\n\n" +
"\t\tREPORT MODULE\n" +
"\t\tdisplay the summary of orders and payments made\n");
number = input.nextLine();
break;
}
}
}
Please use code tags when posting your code. Thank you.