Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hotel occupancy: a hotel's occupancy rate is calculated as follows: occupancy rate = number of rooms occupied / total number of rooms Write a program

Hotel occupancy:

a hotel's occupancy rate is calculated as follows:

occupancy rate = number of rooms occupied / total number of rooms

Write a program that calculates the occupancy rate for each floor of the hotel and the entire hotel.

The program should:

1. ask for the number of floors in the hotel.

2. use a while loop to make sure the number of floor is greater than or equal to one. Display an error message and get a new input when the number of floor is less than 1.

3. Use another loop to iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms on the floor and the number of rooms that are occupied on that floor. Then the loop calculate and display the occupancy rate for that floor using the formula above.

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

For the entire hotel, the total number of rooms is 400, and the total number of occupied rooms is 245. So the

overall occupancy rate for the entire hotel is 61%.

Requirements: pseudocode, you need to include a while loop in your pseudocode

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

Students also viewed these Databases questions