Class Hotel

java.lang.Object
  extended by Hotel

public class Hotel
extends Object

Implements a Hotel with the use of an array

Version:
01 September 2008
Author:
Jessica Sugay

Constructor Summary
Hotel()
          Constructor for a Hotel object.
 
Method Summary
 void addRoom(int roomNumber, double rate)
          Adds a new room to the Hotel
 void changeRoomRate(int roomNumber, double newDailyRate)
          Changes a room's daily rate
 void checkIn(int roomNumber, String occupantName, int day)
          Facilitates checking into a room
 double checkOut(int roomNumber, int day, double extraCharges)
          Facilitates checking out of a room Returns the amount charged to the occupant (return 0 for error cases)
 Room findRoom(int roomNumber)
          Locates the room, given the room number.
 String getOccupant(int roomNumber)
          Returns the current occupant of the given room.
 double getTotalCash()
          Returns the total cash collections for the hotel.
 void printSummary()
          Prints the room number and current occupant of each room of the hotel If room is not occupied, prints "no occupant"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hotel

public Hotel()
Constructor for a Hotel object.

Method Detail

addRoom

public void addRoom(int roomNumber,
                    double rate)
Adds a new room to the Hotel

Parameters:
roomNumber - room number
rate - daily rate of the room

changeRoomRate

public void changeRoomRate(int roomNumber,
                           double newDailyRate)
Changes a room's daily rate

Parameters:
roomNumber - the room number
newDailiyRate - the new rate of the room

checkIn

public void checkIn(int roomNumber,
                    String occupantName,
                    int day)
Facilitates checking into a room

Parameters:
roomNumber - the room number
occupantName - name of the occupant
day - the day the occupant wishes to check in

checkOut

public double checkOut(int roomNumber,
                       int day,
                       double extraCharges)
Facilitates checking out of a room Returns the amount charged to the occupant (return 0 for error cases)

Parameters:
roomNumber - the room number
day - the day the occupant will check out
extraCharges - any extra charges (beyond the room rate)
Returns:
the amount charged to the occupant

findRoom

public Room findRoom(int roomNumber)
Locates the room, given the room number.

Parameters:
roomNumber - room number being searched
Returns:
matching room, if exists

getOccupant

public String getOccupant(int roomNumber)
Returns the current occupant of the given room. Return "Not occupied" if not occupied

Parameters:
roomNumber - the room number
Returns:
the name of the current occupant

getTotalCash

public double getTotalCash()
Returns the total cash collections for the hotel.

Returns:
total cash

printSummary

public void printSummary()
Prints the room number and current occupant of each room of the hotel If room is not occupied, prints "no occupant"