/** * This program tests the Hotel and Receptionist classes. * * @author Jessica Sugay * @version 02 September 2008 */ public class Tester { /** * Main method for the tester. * Creates a hotel object * with initially three room objects and * three receptionist objects. * Receptionist later adds two new room objects. */ public static void main( String args[] ) { Hotel hotel = new Hotel(); hotel.addRoom( 101, 2000.00); hotel.addRoom( 102, 2500.00 ); hotel.addRoom( 103, 3000.00 ); Receptionist r1 = new Receptionist( hotel ); Receptionist r2 = new Receptionist( hotel ); Receptionist r3 = new Receptionist( hotel ); System.out.printf( "Total Sales : %8.2f\n", hotel.getTotalCash() ); System.out.printf( "Receptionist 1: %8.2f\n", r1.getCash() ); System.out.printf( "Receptionist 2: %8.2f\n", r2.getCash() ); System.out.printf( "Receptionist 3: %8.2f\n", r3.getCash() ); hotel.printSummary(); // all rooms empty r1.checkIn( 101, "Bob", 1 ); r2.checkIn( 102, "Joe", 2 ); r1.checkOut( 101, 3, 100.00 ); r1.changeRoomRate( 101, 10000.00 ); r1.checkIn( 101, "Ann", 3 ); r3.checkOut( 102, 3, 200.00 ); r2.checkIn( 103, "Liz", 3 ); r2.changeRoomRate( 103, 4000.00 ); // error System.out.println( "---" ); System.out.printf( "Total Sales : %8.2f\n", hotel.getTotalCash() ); System.out.printf( "Receptionist 1: %8.2f\n", r1.getCash() ); System.out.printf( "Receptionist 2: %8.2f\n", r2.getCash() ); System.out.printf( "Receptionist 3: %8.2f\n", r3.getCash() ); hotel.printSummary(); System.out.println( "---" ); r1.checkIn( 201, "Dan", 6 ); // error r1.checkIn( 101, "Dan", 6 ); // error r1.checkIn( 102, "Dan", 2 ); // error hotel.printSummary(); r1.addNewRoom( 103, 1000.00 ); // error r1.addNewRoom( 104, 3500.00 ); r1.checkIn( 104, "Tom", 3); r2.addNewRoom( 105, 4000.00 ); r2.checkIn( 105, "Jim", 5); r2.checkOut( 101, 8, 0.50 ); r3.checkOut( 103, 8, 1.00 ); r2.checkOut( 103, 10, 1.00 ); // error System.out.println( "---" ); System.out.printf( "Total Sales : %8.2f\n", hotel.getTotalCash() ); System.out.printf( "Receptionist 1: %8.2f\n", r1.getCash() ); System.out.printf( "Receptionist 2: %8.2f\n", r2.getCash() ); System.out.printf( "Receptionist 3: %8.2f\n", r3.getCash() ); hotel.printSummary(); } }