Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Flowchart or Python code Hotel occupancy: a hotel's occupancy rate is calculated as follows: occupancy rate = number of rooms occupied / number of rooms

Flowchart or Python code
Hotel occupancy:
a hotel's occupancy rate is calculated as follows:
occupancy rate = number of rooms occupied / number of rooms available
Design a program that calculates and displays the occupancy rate for each floor and the entire hotel. The program should start by asking for the number of floors in the hotel. Then a loop should iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms available on the floor and the number of rooms occupied on that floor. Then the loop calculates and displays the occupancy rate for that floor.
After all the iterations, the program should display the total number of rooms the hotel has, the total number of rooms occupied in the hotel, and the total number of rooms that are vacant in the hotel, and the overall occupancy rate for the entire hotel.
For example: A hotel has 4 floors.
Floor 1: 100 rooms, 60 occupied. Then the occupancy rate for floor 1 is 0.60.
Floor 2: 150 rooms, 90 occupied. Then the occupancy rate for floor 2 is 0.60
Floor 3: 60 rooms, 50 occupied. Then the occupancy rate for floor 3 is 0.86
Floor 4: 90 rooms, 45 occupied. The the occupancy rate for floor 4 is 0.50
Altogether, the hotel has 400 rooms, 245 rooms are occupied, 155 rooms are vacant. The overall occupancy rate for the hotel is 0.61
In the assignment, input validation is required (please note that a repetition structure, not a decision structure should be used for input validation)
a). the number of floors for the hotel could not be 0 or negative
b). the number of rooms for a floor could not be 0 or negative
c). the number of rooms occupied for a floor should never be greater than the number of available rooms for that floor
image text in transcribed
image text in transcribed
image text in transcribed
Hotel occupancy: a hotel's occupancy rate is calculated as follows: occupancy rate = number of rooms occupied / number of rooms available Design a program that calculates and displays the occupancy rate for each floor and the entire hotel. The program should start by asking for the number of floors in the hotel. Then a loop should iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms available on the floor and the number of rooms occupied on that floor. Then the loop calculates and displays the occupancy rate for that floor. After all the iterations, the program should display the total number of rooms the hotel has, the total number of rooms occupied in the hotel, and the total number of rooms that are vacant in the hotel, and the overall occupancy rate for the entire hotel. For example: A hotel has 4 floors. Floor 1: 100 rooms, 60 occupied. Then the occupancy rate Floor 1: 100 rooms, 60 occupied. Then the occupancy rate for floor 1 is 0.60. Floor 2: 150 rooms, 90 occupied. Then the occupancy rate for floor 2 is 0.60 Floor 3: 60 rooms, 50 occupied. Then the occupancy rate for floor 3 is 0.86 Floor 4: 90 rooms, 45 occupied. The the occupancy rate for floor 4 is 0.50 Altogether, the hotel has 400 rooms, 245 rooms are occupied, 155 rooms are vacant. The overall occupancy rate for the hotel is 0.61 In the assignment, input validation is required (please note that a repetition structure, not a decision structure should be used for input validation) a). the number of floors for the hotel could not be 0 or negative b). the number of rooms for a floor could not be 0 or negative c). the number of rooms occupied for a floor should never be greater than the number of available rooms for that floor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

what is a verbal model in marketing research? explain in detail

Answered: 1 week ago