// MENU APPLICATION CLASS // Frans Coenen // University of Liverpool // 27 April 2013 import java.util.*; class MenuApp { // ------------------- FIELDS ------------------------ // Create instance of Scanner class private static Scanner input = new Scanner(System.in); // ------------------ METHODS ------------------------ /** Main method to output menu, allow fopr input of selector and processing of selector. */ public static void main(String[] args) { // Menu loop while (true) { // Output menu System.out.println("---------------------------------------------------"); System.out.println("Select one of the following options"); System.out.println("\t(1) Prepare new quote"); System.out.println("\t(2) Load and view existing quote"); System.out.println("\t(3) Load new cost data"); System.out.println("\t(4) Generate monthly report summary"); System.out.println("\t(5) Exit"); System.out.println("---------------------------------------------------"); // Get selection int selector = input.nextInt(); // Case statement switch (selector) { case (1) : System.out.println("[1] Prepare new quote selected"); break; case (2) : System.out.println("[2] Load and view existing quote selected"); break; case (3) : System.out.println("[3] Load new cost data selected"); break; case (4) : System.out.println("[4] Generate monthly report summary selected"); break; case (5) : System.out.println("[5] Exit selected"); System.exit(1); default : System.out.println("ERROR 1: Unrecognised menu option \"" + selector + "\"!"); } } } }