Question: Problem Statement (Summary): You are going to develop a simple application for Hotels. Hotel is, actually, a Building, with some extra features. Each hotel as

Problem Statement (Summary): You are going to develop a simple application for Hotels. Hotel is, actually, a Building, with some extra features. Each hotel as a couple of rooms. Each room, has some features, including its own calendar, to keep its reservation records. To implement and test this system, you must create six Java classes as follows:

Class Person (4 marks): Open the Java file Person.java that is provided. Later on, you must use this class in Reservation and Hotel classes. Complete this Java class using the following specifications:

Every person has first and last names. (1 mark)

A constructor, which gets two parameters, first and last names, and initializes the corresponding instance variables. (1 mark) Override the toString method, such that it returns first and last names with one space in between. (2 marks)

Class Building (4 marks): Open the Java file Building.java that is provided. Complete this Java class using the following specifications:

Every building has year of built and number of floors. (1 mark) A default constructor, which initializes the year of built to the current year, and floor to 1. Note that current year must not be hard coded, like 2021. (2 marks)

Another constructor with two parameters, year of built and floor, which initializes the corresponding instance variables. (1 mark)

Class Reservation (15 marks): Open the Java file Reservation.java that is provided. The purpose of this class is to keep the record of each reservations of a room. Later on, you must use this class inside the Room class. Complete this Java class using the following specifications:

Every reservation instance object has (6 marks) o start date and end date (Hint: Use Date class for the type of these two instance variables. Date is a class inside java.sql package.) o price per night o guest (Hint: Type of this instance variable should be Person) o reservation number (The first reservation number must be 10001. Therefore, you must have a class-level variable that keeps the last reservation number used.) A constructor with four parameters, start date, end date, price, and guest. Note that you must set the reservation number for this reservation in this constructor as well. (1 mark)

Getter methods for the start date, end date and the reservation number. (3 marks)

A method, available, which gives start date (inclusive) and end date (exclusive) and will check if the room is available during these dates or not. (3 marks)

Override the toString method, such that it returns a string including the reservation number, start and end dates, guest, and price, with the format like example below. (2 marks) Reservation Number: 10002. From: 2021-02-27 To: 2021-02-28, Guest: Maria Aunt, $35.5 per night.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!