Text: Java language
Constraints: Don't use System.exit(0) to exit our code. Use descriptive variable names. Format output for any decimal numbers using the printf method discussed in chapter 4 with 2 digits after the decimal point.
Process:
The cost of renting a room at a hotel is $100.00 per night. For special occasions, such as a wedding or a conference, the hotel offers a special discount as follows:
- If the number of rooms booked is between 1 and 10, the discount is 10%.
- If the number of rooms booked is more than 10 but less than or equal to 20, the discount is 20%.
- If the number of rooms booked is more than 20, the discount is 30%.
If rooms are booked for at least 3 days, then there is an additional 5% discount.
Your program will:
- Ask for a password. The correct password is "123a". Note that the password is case sensitive.
- If the password is incorrect, issue an error message and do not calculate or display any output (i.e. no processing if the password is incorrect).
- If the password is correct:
- Generate a random number between 1 and 10,000 and assign it as the booking identification number.
- Ask for the cost of renting one room.
- Ask for the number of rooms booked.
- Ask for the number of days the rooms are booked.
- Ask for the sales tax as a percent, i.e. 10 for 10%.
The program outputs:
- The booking identification number.
- The cost of renting one room.
- The discount on each room as a percent.
- The discount based on the number of days as a percent.
- The number of rooms booked.
- The number of days the rooms are booked.
- The total cost of the rooms before tax rounded up to the nearest integer.
- The sales tax (calculated based on the total bill before any discounts) rounded down to the nearest integer.