Final answer:
Purpose: To calculate the occupancy rate for a hotel based on user input about the number of floors, rooms per floor, and their occupancy status.
Input: Number of floors in the hotel, number of rooms per floor, number of occupied rooms per floor.
Process: Loop through each floor, collecting information about the rooms and their occupancy status.
Output: Total rooms in the hotel, occupied rooms, unoccupied rooms, and the percentage of occupied rooms.
Step-by-step explanation:
Here's an overview of the characteristics (purpose, input, process, output), three test cases, pseudocode, and a flowchart for the program to calculate the occupancy rate for a hotel:
Characteristics:
Purpose: To calculate the occupancy rate for a hotel based on user input about the number of floors, rooms per floor, and their occupancy status.
Input: Number of floors in the hotel, number of rooms per floor, number of occupied rooms per floor.
Process: Loop through each floor, collecting information about the rooms and their occupancy status.
Output: Total rooms in the hotel, occupied rooms, unoccupied rooms, and the percentage of occupied rooms.
Test Cases:
Test Case 1:
Number of floors: 5
Rooms per floor: 15, 20, 25, 30, 35
Occupied rooms: 10, 15, 20, 25, 30
Test Case 2:
Number of floors: 8
Rooms per floor: 12, 18, 24, 30, 22, 28, 16, 20
Occupied rooms: 6, 9, 12, 15, 11, 14, 8, 10
Test Case 3:
Number of floors: 15
Rooms per floor: 25 for all floors
Occupied rooms: 20 for all floors
Pseudocode:
Start
Initialize variables: totalRooms = 0, totalOccupiedRooms = 0
Ask user for the number of floors
While loop for each floor (1 to number of floors)
Skip if floor number is 13
Ask user for the number of rooms on the floor
Validate rooms per floor (should be >= 10)
Ask user for the number of occupied rooms on the floor
Validate occupied rooms (should be <= rooms per floor)
Add rooms per floor to totalRooms
Add occupied rooms to totalOccupiedRooms
End loop
Calculate unoccupied rooms = totalRooms - totalOccupiedRooms
Calculate occupancy rate = (totalOccupiedRooms / totalRooms) * 100
Display totalRooms, totalOccupiedRooms, unoccupied rooms, occupancy rate
End