Write an application for the Shady Rest Hotel; the program determines the price of a room. Ask the user to choose 1 for a queen bed, 2 for a king, or 3 for a king and a pullout couch. The output echoes the input and displays the price of the room: $125 for queen, $139 for king, and $165 for suite with king bed and a pullout couch. If the user enters an invalid code, display You selected an invalid option and set the price to 0.

Respuesta :

Answer:

The programming language is not stated; However, I'll answer this question using Python programming language.

This program does not make use of comments; See explanation section for detailed explanation of the program

Program starts here

print("Welcome to Shady Rest Hotel")

print("Please select any of the following:")

print("Press 1 for a queen bed:")

print("Press 2 for a king:")

print("Press 2 for a king and a pullout:")

userinput = input("Enter your selection: ")

if userinput == "1":

     print("You selected the queen bed")

     print("Price = $125")

elif userinput == "2":

     print("You selected a king bed")

     print("Price = $139")

elif userinput == "3":

     print("You selected a suite with king bed and a pullout couch")

     print("Price = $165")

else:

     print("Invalid Selection")

     print("Price = $0")

Explanation:

This line welcomes the user to the hotel

print("Welcome to Shady Rest Hotel")

The next 4 lines (italicized) gives instruction to the user on how to make selection

print("Please select any of the following:")

print("Press 1 for a queen bed:")

print("Press 2 for a king:")

print("Press 2 for a king and a pullout:")

This line prompts the user for input

userinput = input("Enter your selection: ")

If user input is 1, the italicized lines displays user selection, which is the queen bed and the price; $125

if userinput == "1":

     print("You selected the queen bed")

     print("Price = $125")

However, if user input is 2, the italicized lines displays user selection, which is the king bed and the price; $139

elif userinput == "2":

     print("You selected a king bed")

     print("Price = $139")

However, if user input is 3, the italicized lines displays user selection, which is a suite with king bed and a pullout couch and the price; $165

elif userinput == "3":

     print("You selected a suite with king bed and a pullout couch")

     print("Price = $165")

Lastly, the following is executed if user input is not 1, 2 or 3 and the price is set to 0

else:

     print("Invalid Selection")

     print("Price = $0")