import java.util.*; /** * This is the Reservation System Tester, this is used to check and verify * that the actual code is working correctly. * * @author Carlos Vega * @version 05/03/22 */ public class ReservationSystemTester { public static void main(String[] Args) { Scanner kb = new Scanner(System.in); Restaurant rst = new Restaurant(); //sample tester, current reservations at the restaurant rst.add(new Reservation("Carlos", 5)); rst.add(new Reservation("Chris", 4)); rst.add(new Reservation("Sara", 3)); rst.add(new Reservation("Matthew", 2)); rst.add(new Reservation("Compsci", 9)); boolean done = false; while(!done) { System.out.println("----------------------------------------------"); System.out.println("Hello Welcome to Restaraunt Reservation System"); System.out.println("If you wish to find reservation, type '0' "); System.out.println("If you wish to check check-in, type '1' "); System.out.println("To quit, type '2' "); int choice = kb.nextInt(); //Choice 0 is for findReservation(String n, int s) if (choice == 0) { System.out.println(" "); System.out.print("The name of reserver: "); String name = kb.next(); System.out.print("Enter number of people: "); int seats = kb.nextInt(); rst.findReservation(name.toLowerCase(), seats); if (rst.getCurrentPlace() >= 0) { System.out.println("Your reservation is number: " + rst.getCurrentPlace()); } else if (rst.getCurrentPlace() < 0) { System.out.println("You do not have a reservation"); } System.out.println(" "); System.out.print("Do you wish to go back ('0' yes, or '1' no): "); choice = kb.nextInt(); if(choice == 0) { done = false; } else if (choice == 1) { done = true; } } //Choice 1 is for newListUpdated(String n, int s) else if (choice == 1) { System.out.println(" "); System.out.print("Enter check-in name: "); String name = kb.next(); System.out.print("Enter number of people: "); int seats = kb.nextInt(); if (rst.findReservation(name, seats) >= 0) { System.out.println(" "); System.out.println("Hello " + name + " you have been checked in, thank you!"); System.out.print("I will now remove you from the list."); } else if (rst.findReservation(name, seats) < 0) { System.out.println(" "); System.out.println("Hello " + name + " you have been added to the list, thank you!"); System.out.print("you are reservation number is: " + rst.getLength()); } rst.newListUpdated(name.toLowerCase(), seats); System.out.println(" "); System.out.println(rst.toString()); System.out.println(" "); System.out.print("Do you wish to go back ('0' yes, or '1' no): "); choice = kb.nextInt(); if(choice == 0) { done = false; } else if (choice == 1) { done = true; } } else if(choice == 2) { done = true; } } } }