Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (!response.equals("stop")) {
- System.out.println("\n\nWhat do you want to do? You can type 'manual' to add a record manually, " +
- "'reset' to reset the passengers and schedules tables or 'file' to load records from a " +
- "file. Type 'stop' to exit. Do not type the quotations");
- response = input.nextLine();
- switch (response) {
- case "manual":
- String resp = "";
- while(true) {
- System.out.println("What is the passenger information you want to load in? The format to " +
- "input a passenger record is 'P TUID First_Initial Middle_Initial Last_Name " +
- "Phone_Number'. Type stop to back out");
- System.out.println();
- resp = input.nextLine();
- if(resp.equals("stop")){
- break;
- }
- insertIntoPassenger(resp, state);
- System.out.println("What is the schedule information you want to load in? The format to " +
- "input schedule information S Customer_TUID Requested_Plane_TUID " +
- "Requested_Seating_Type Requested_Date:");
- System.out.println();
- resp = input.nextLine();
- if(resp.equals("stop")){
- break;
- }
- insertIntoScheduleTable(resp);
- }
- break;
- case "reset":
- DBClass.tableReset();
- break;
- case "file":
- System.out.println("What is the name of the file you want to load in. Example: 'sample.txt' without the quotations");
- Scanner sc = new Scanner(new File(input.next()));
- while (sc.hasNextLine()) {
- String line = sc.nextLine();
- if (line.charAt(0) == 'P') {
- insertIntoPassenger(line, state);
- } else if (line.charAt(0) == 'S') {
- insertIntoScheduleTable(line);
- }
- }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement