69.9k views
3 votes
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.

User Meucaa
by
4.6k points

1 Answer

2 votes

Answer:

Written in Python

cost = float(input("Cost of one room: "))

numrooms = int(input("Number of rooms: "))

days = int(input("Number of days: "))

salestax = float(input("Sales tax (%): "))

print("Cost of one room: "+str(cost))

print("Discount: 0%")

print("Number of rooms: "+str(numrooms))

print("Number of days: "+str(days))

totalcost = numrooms * cost

print("Total cost: "+str(totalcost))

salestax = salestax * totalcost/100

print("Sales tax: "+str(salestax))

print("Total Billing: "+str(salestax + totalcost))

Step-by-step explanation:

The next four lines prompts user for inputs as stated in the question

cost = float(input("Cost of one room: "))

numrooms = int(input("Number of rooms: "))

days = int(input("Number of days: "))

salestax = float(input("Sales tax (%): "))

The following line prints cost of a room

print("Cost of one room: "+str(cost))

The following line prints the discount on each room (No information about discount; So, we assume it is 0%)

print("Discount: 0%")

The following line prints number of rooms

print("Number of rooms: "+str(numrooms))

The following line prints number of days

print("Number of days: "+str(days))

The following line calculates total cost of rooms

totalcost = numrooms * cost

The following line prints total cost

print("Total cost: "+str(totalcost))

The following line calculates sales tax

salestax = salestax * totalcost/100

The following line prints sales tax

print("Sales tax: "+str(salestax))

The following line calculates and prints total billings

print("Total Billing: "+str(salestax + totalcost))

User Bryan E
by
6.1k points