Question: public class Exercise 0 4 _ HotelReservation { / * Innovator's Inn is a new hotel chain with two simple rates: $ 9 9 .
public class ExerciseHotelReservation
Innovator's Inn is a new hotel chain with two simple rates:
$ per night for stays of or nights
$ per night for stays of nights or more
The problems below ask you to implement the logic for determining a guest's total amount for their stay.
You can use these constants in your solutions.
private final double DAILYRATE ;
private final double DISCOUNTRATE ;
private final double PARKINGRATE ;
private final double LATECHECKOUTFEE ;
private final int MINIMUMNIGHTSFORDISCOUNTRATE ;
Using the rates from above, implement the logic to determine the total amount based on
the number of nights a guest stays.
Examples:
calculateStayTotal
calculateStayTotal
calculateStayTotal
public double calculateStayTotalint numberOfNights
if numberOfNights
return numberOfNights DISCOUNTRATE;
else
return numberOfNights DAILYRATE;
The owners of Innovator's Inn offer parking at an additional cost of $ per night.
Calculate the stay total based on the number of nights int
and on whether the guest requires parking boolean
Examples:
calculateStayTotal false
calculateStayTotal true
calculateStayTotal false
calculateStayTotal true
public double calculateStayTotalint numOfTotalNights, boolean includesParking
Innovator's Inn offers late checkoutbut it comes at a price.
A guest can reserve a late checkout for an additional fee of $
Calculate the stay total given the number of nights int
whether they require parking boolean and whether they require a late checkout boolean
Examples:
calculateStayTotal false, false
calculateStayTotal false, true
calculateStayTotal true, false
calculateStayTotal true, true
calculateStayTotal false, false
calculateStayTotal false, true
calculateStayTotal true, false
calculateStayTotal true, true
public double calculateStayTotalint numOfTotalNights, boolean includesParking, boolean includesLateCheckout
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
