Caution: You have to use a specific patter (double | float | const) The cost of
ID: 3722939 • Letter: C
Question
Caution: You have to use a specific patter (double | float | const)
The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a wedding or conference, the hotel offers a special discount as follows.
If the number of rooms booked is:
at least 10, the discount is 10%
at least 20, the discount is 20%
at least 30, the discount is 30%
Also if rooms are booked for at least three days, then there is an additional 5% discount.
Instructions
Write a program that prompts the user to enter:
The cost of renting one room
The number of rooms booked
The number of days the rooms are booked
The sales tax (as a percent).
The program outputs:
The cost of renting one room
The discount on each room as a percent
The number of rooms booked
The number of days the rooms are booked
The total cost of the rooms
The sales tax
The total billing amount.
Your program must use appropriate named constants to store special values such as various discounts.
Explanation / Answer
#User inputs
CostOfOneRoom = int(input("The cost of renting one room: "))
NumberOfRoomsBooked = int(input("The number of rooms booked: "))
NumberOfDaysRoomsBooked = int(input("The number of days the rooms are booked: "))
SalesTax = float(input("The sales tax(as a percent): "))
#Calculations
TotalCostOfRooms = CostOfOneRoom * NumberOfRoomsBooked * NumberOfDaysRoomsBooked
SalesTaxOutput = TotalCostOfRooms * (SalesTax / 100)
TotalBillingAmount = TotalCostOfRooms + SalesTaxOutput
Discount = 0
if(NumberOfRoomsBooked >= 10 and NumberOfRoomsBooked < 20):
TotalBillingAmount *= 0.9
Discount = 10
elif(NumberOfRoomsBooked >= 20 and NumberOfRoomsBooked < 30):
TotalBillingAmount *= 0.8
Discount = 20
elif(NumberOfRoomsBooked >= 30):
TotalBillingAmount *= 0.7
Discount = 30
if(NumberOfDaysRoomsBooked >= 3):
TotalBillingAmount *= 0.95
Discount += 5
#Output window
print(" ************Outputs After Applying Sales tax and Discount************ ")
print("The cost of renting one room: ",(TotalBillingAmount / (NumberOfRoomsBooked * NumberOfDaysRoomsBooked)))
print("The discount on each room as a percent: ", Discount,"%")
print("The number of rooms booked: ",NumberOfRoomsBooked)
print("The number of days the rooms are booked: ",NumberOfDaysRoomsBooked)
print("The total cost of rooms: ",TotalCostOfRooms)
print("The sales tax: ",SalesTaxOutput)
print("The total billing amount: ", TotalBillingAmount)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.