Hi I am trying to write a program to determine hotel occupancy. I am STUCK in my loop!!!! What is wrong with this code?!
The program should begin by asking for the number of floors. The program should then iteratively ask for the total number of rooms on each floor and how many of those are currently occupied. After all the floor info is entered, the program displays how many total rooms the hotel has, how many are occupied, how many are unoccupied and the percentage of rooms that are occupied. Also print which floor is the Heartbreak floor (floor with most empty rooms)
1. Use a for loop for looping control structure
2. Validate that the number of floors is at least 1. Use a while loop to validate the input and display an error message.
3. Each floor must have at least 10 rooms.
4. The number of rooms occupied for each floor must not exceed the number of room on the floor and cannot be less than 0. Display an error message.
5. Skip the second floor completely
6. Display the percentage value in standard percent format with one decimal place.
Line 18: Why are you incrementing floor? Your for loop does that for you.
Line 19: Why are you adding floor to numfloors? numfloors shouldn't change.
Lines 36-40 are in the wrong place. You should edit the value BEFORE you us it at line 16.
Line 26: Where is totrooms initialized? Why are you changing numrooms which you just got from the user?
Lines 41-45 are in the wrong place. You should edit numrooms BEFORE you use it.
Line 27: The if statement is misplaced. I would presume that "skip the second floor" means not to ask how many rooms are on the second floor.
Lines 46-50 are misplaced. You should edit check fullrms before you use it.
Line 30: Where is emptyrms calculated?
Line 61: Where are hbfloor and hbempty values set?