Question: Create a Java Reservation Calculation program with that satisfies the specifications stated below. Operation This application calculates the charges for a stay at a hotel

Create a Java Reservation Calculation program with that satisfies the specifications stated below.

Operation

This application calculates the charges for a stay at a hotel based on the arrival and departure dates.

The application prompts the user for the month, day, and year of the arrival and the departure. Then, the application displays the arrival date, the departure date, the room rate, the total price, and the number of nights.

Specifications

Create a presentation layer class named ReservationApp which contains the Main Method. All input/output is done through this class.

Create a class named Reservation that defines a reservation. This class should contain instance variables for the arrival date and departure date. It should also contain a constant initialized to the nightly rate of $105.00.

The Reservation class should include the following methods:

setArrivalDate(LocalDate arrivalDate)

LocalDate getArrivalDate()

String getArrivalDateFormatted()

setDepartureDate(LocalDate departureDate)

LocalDate getDepartureDate()

String getDepartureDateFormatted()

int getNumberOfNights()

String getPricePerNightFormatted()

double getTotalPrice()

String getTotalPriceFormatted()

To calculate the total number of nights, you can use the toEpochDay method to get the number of days since Jan 1, 1970 for the arrival and departure dates. Then, you can use normal arithmetic operators.

Sample Output

Reservation Calculation System Startup

Enter the arrival month (1-12): 1

Enter the arrival day (1-31): 11

Enter the arrival year: 2017

Enter the departure month (1-12): 1

Enter the departure day (1-31): 13

Enter the departure year: 2017

Arrival Date: January 11, 2017

Departure Date: January 13, 2017

Price: $105.00 per night

Total price: $210.00 for 2 nights

Continue? (y/n): n

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!