Question

Create a class called Hotel. The hotel class will track the current reservations for your one-room...

Create a class called Hotel. The hotel class will track the current reservations for your one-room hotel for the month of May only. So it must only maintain reservations for the 1stthrough 31stof May.

You can design the class to suit your needs, but it must contain the following public methods.

•StringmakeReservation(String name, int firstDay, int lastDay)oAttempt to make a reservation from the firstDay to the lastDay (inclusive) for the person specified by name restrictions

▪A user may only have one reservation. If they already have a reservation, do not allow a new one

▪Do not make a reservation ifvaluesfirstDay and lastDay are invalid in any way.

▪Only make a reservation if all of the requesteddays are availableoReturn a string withthe information about the reservation if it was made or describing the reason the reservation was not made.

•String cancelReservation(String name)oIf the specified person has a reservation, cancel it (all of their days become available) and return a message confirming this was done.oOtherwise, return a message stating the user did not have a reservation to cancel

•String reservationInformation()

oReturn a string containing the full reservation information for the month. For each day display either available or the name of the person who has the reservation for that day. Use newline characters to format the data well

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Java code skeleton to design an online hotel

// reservation system.

Enums:

public enum RoomStatus {

    EMPTY

        NOT_EMPTY;

}

public enum PaymentStatus {

    PAID,

    UNPAID;

}

public enum Facility {

    LIFT;

    POWER_BACKUP;

    HOT_WATERR;

    BREAKFAST_FREE;

    SWIMMING_POOL;

}

class User {

    int userId;

    String name;

    Date dateOfBirth;

    String mobNo;

    String emailId;

    String sex;

}

// For the room in hotel

class Hotel {

    int hotelId;

    String hotelName;

Information information;

    // hotel contains the list of rooms

    List<Room> rooms;

    float rating;

    Facilities facilities;

}

// a new booking is created for each booking

// done by any user

class Reservation {

    int ReservationId;

    int userId;

    int hotelId;

    // We are assuming that in a single

    // booking we can book only the rooms

    // of a single hotel

    List<Rooms> bookedRooms;

     

    int amount;

    PaymentStatus status_of_payment;

    Date bookingTime;

    Duration duration;

}

class Information {

    String city;

    String pinCode;

    String state;

    String streetNo;

    String landmark;

}

class Duration {

    Date from;

    Date to;

}

class Facilities {

    List<Facility> facilitiesList;

}

Add a comment
Know the answer?
Add Answer to:
Create a class called Hotel. The hotel class will track the current reservations for your one-room...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Add locking to the Hotel class. Since it is going to be accessed by multiple threads,...

    Add locking to the Hotel class. Since it is going to be accessed by multiple threads, possibly simultaneously, locking is required to ensure the data remains valid. Just lock all of the reservation information when necessary. This is a simple case, so you can either use a Lock object, or the synchronized keyword. There is no need to use a condition, wait, await, signalAll, or notifyAll. public enum RoomStatus { EMPTY NOT_EMPTY; } public enum PaymentStatus { PAID, UNPAID; }...

  • Use Case Modeling APPENDIX-A Online Hotel Reservation System RichOS hotels owner Mr. Tompkins wanted an online...

    Use Case Modeling APPENDIX-A Online Hotel Reservation System RichOS hotels owner Mr. Tompkins wanted an online reservation system (HORSE) for his new hotel located in Antalya. The hotel has two types of rooms: regular and suit. In order to make a reservation or cancel any other, the clients (persons or travel agency) must logon the system. The clients should register to the system through their names, e-mail and telephone information. Clients will be able to query the availability of the...

  • While vacationing in England, you decide to take an impromptu trip outside of London to see some ...

    While vacationing in England, you decide to take an impromptu trip outside of London to see some of the country. You phone several hotels in the area but are told that all rooms are reserved. You and your friends decide to go anyway, vowing that if worse comes to worse you will all sleep in the car. Having driven the 100 miles from London, you stop at the first hotel you see, Ye Olde Ox and Bow, and are surprised...

  • QUESTION 1. The Bates Motel has 12 rooms available to rent this evening, but they have overbooked and made 14 room reservations. The probability a person cancels their room reservation is 0.11 independent of each other person. Let X represent the number o

    QUESTION 1. The Bates Motel has 12 rooms available to rent this evening, but they have overbooked and made 14 room reservations. The probability a person cancels their room reservation is 0.11 independent of each other person. Let X represent the number of room reservations that are cancelled for this evening. (a) What is the probability distribution of X? State the name of the probability distribution and the value(s) of any relevant parameter(s). (b) How many room reservations would you...

  • All three pictures are parts of the question.        &nbs...

    all three pictures are parts of the question.           please solve in c++ Lab 5.3.2 Flight booking system: part 2 Objectives Familiarize the student with: modelling real-workd entities with classes and objects; limiting acceptable input range. Scenario Let's continue working on our booking system You may remember in our last task that we had no limit on the number of reserved seats. Airlines often allow the overbooking of flights, expecting that some passengers will not make it. Modify the constructor so...

  • Using your Dog class from earlier this week, complete the following: Create a new class called...

    Using your Dog class from earlier this week, complete the following: Create a new class called DogKennel with the following: Instance field(s) - array of Dogs + any others you may want Contructor - default (no parameters) - will make a DogKennel with no dogs in it Methods: public void addDog(Dog d) - which adds a dog to the array public int currentNumDogs() - returns number of dogs currently in kennel public double averageAge() - which returns the average age...

  • You will have to write one method in the GradeHistogram class The method should be called...

    You will have to write one method in the GradeHistogram class The method should be called printDataRow It has two formal parameters A string for the row label An int for how many asterisks are in the row The method will print The string that was passed in followed by a colon and a space The asterisks (*) After the last asterisk it will print a newline Example: the statement: printDataRow("Number of As", 7); would output the following Number of...

  • Programming language C++. (Airline Reservations System) A small airline has just purchased a computer for its...

    Programming language C++. (Airline Reservations System) A small airline has just purchased a computer for its new au- tomated reservations system. You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Display the following alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your app should assign a seat in the first-class section...

  • Within DrJava, create a class called StudentQuizScores and do the following using a do-while loop. 1....

    Within DrJava, create a class called StudentQuizScores and do the following using a do-while loop. 1. You program will read in a student’s first name. The same will be done for the student’s last name. Your program will use respective methods (described below) to accomplish this. 2. Your program will then read in three quiz scores, respectively. This should be done by using the same method three times. This method is described below. 3. Your program will then calculate the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT