Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Hotel
- {
- private Room[] theRooms;
- private String name;
- private int totalDays;
- private double totalRate;
- private int singleCount;
- private int doubleCount;
- private int roomsRented;
- private int NUM_ROOMS;
- private int NOT_FOUND;
- /**
- Constructer
- */
- public Hotel(String hotelnam)
- {
- name = hotelnam;
- NUM_ROOMS = 20;
- theRooms = new Room[NUM_ROOMS];
- }
- /**
- will return the total rental income by summing the rental cost for each room rented out.
- */
- public double getTotalRentalSales()
- {
- int i = 0;
- double adder = 0.0;
- while(i < NUM_ROOMS)
- {
- adder = (theRooms[i].getRate() * theRooms[i].getNumOfDays()) + adder;
- i++;
- }
- return totalDays;
- }
- /**
- will return the average number of days that rooms are rented out for.
- */
- public double getAvgDays()
- {
- int i2 = 0;
- double adder2 = 0.0;
- while(i2 < NUM_ROOMS)
- {
- adder2 = theRooms[i2].getNumOfDays() + adder2;
- i2++;
- }
- adder2 = adder2/i2;
- return adder2;
- }
- /**
- will return the average rental rate for the rooms.
- */
- public double getAvgRate()
- {
- int i3 = 0;
- double adder3 = 0.0;
- double num = 0.0;
- while(i3 < NUM_ROOMS)
- {
- totalRate = theRooms[i3].getRate() + totalRate;
- num++;
- i3++;
- }
- adder3 = totalRate/num;
- return totalRate;
- }
- /**
- will return the number of rooms with one bed.
- */
- public int getSingleCount()
- {
- int i4 = 0;
- int adder4 = 0;
- while(i4 < NUM_ROOMS)
- {
- if (theRooms[i4].getNumBeds() == 1)
- {
- singleCount++;
- }
- i4++;
- }
- return singleCount;
- }
- /**
- will return the number of rooms with two beds.
- */
- public int getDoubleCount()
- {
- int i5 = 0;
- int adder5 = 0;
- while(i5 < NUM_ROOMS)
- {
- if (theRooms[i5].getNumBeds() == 2)
- {
- doubleCount++;
- }
- i5++;
- }
- return doubleCount;
- }
- /**
- will print out the information for each room by calling the toString method for each Room instance.
- */
- public void printRentalList()
- {
- int i6 = 0;
- while(i6 < NUM_ROOMS)
- {
- theRooms[i6].toString();
- i6++;
- }
- }
- /**
- FINSH LATER
- public void addReservation(String gname, int theroom, int beds, double therate, int thedays)
- {
- gname = theRooms[].setGuest();
- theroom = theRooms[].setNumber();
- beds = theRooms[].setNumBeds();
- therate = theRooms[].setRate();
- thedays = theRooms[].setNumOfDays();
- }
- */
- /**
- takes a room number and checks whether there is a reservation for this room. If a reservation is found, the method will print out the room's information using the room’s toString method. If not, the method prints out a message indicating that the reservation was not found.
- public reportReservation(int checkroom)
- {
- if (checkroom)
- {
- }
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement