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)); int choice = 0; while(choice < 2) { System.out.println("\n----------------------------------------------"); System.out.println("Hello Welcome to Restaraunt Reservation System"); System.out.println("There are now " + rst.getLength() + " in the waiting list.\n" + rst); System.out.print("Type '0' to Find a reservation, "); System.out.print("Type '1' to Check-In, "); System.out.print("Type '2' to quit: "); choice = Integer.parseInt(kb.next()); //Choice 0 is for findReservation(String n, int s) if (choice == 0) { System.out.print("\nThe name of customer: "); String name = kb.next().toLowerCase(); System.out.print("Enter number of people: "); int seats = Integer.parseInt(kb.next()); int result = rst.findReservation(name.toLowerCase(), seats); System.out.print("Your reservation was "); if (result < 0) System.out.println("not found."); else System.out.println(" found. There are " + result + " before this reservation."); } //Choice 1 is for checkIn(String name, int seats) else if (choice == 1) { System.out.print("\nEnter check-in name: "); String name = kb.next().toLowerCase(); System.out.print("Enter number of people: "); int seats = Integer.parseInt(kb.next()); boolean checkedIn = rst.checkIn(name, seats); if (checkedIn) { System.out.println(" "); System.out.println("Thank you " + name + " you have been checked in. "); System.out.println("I will now remove you from the waiting list. Bon Appetit!"); } else { System.out.println(" "); System.out.println("Hello " + name + " you have been added to the list, thank you!"); System.out.println("There are : " + (rst.getLength()-1) + " parties ahead of you."); } } } System.out.println("Thank you for using the RRS."); } }