In C++
Write a program that calculates the occupancy rate for a hotel. The program should start by asking the user how many floors the hotel has. A loop should then iterate once for each floor. In each iteration, the loop should ask the user for the number of rooms on the floor and how many of them are occupied. After all iterations, the program should display how many room the hotel has, how many of them are occupied, how many are unoccupied, and the percentage of rooms that are occupied. The percentage may be calculated by dividing the number of rooms occupied by the number of rooms.
NOTE: It is traditional that most hotels do not have a thirteenth floor. The loop in this program should skip the entire thirteenth iteration.
Input Validation: Do not accept a value less than 1 for the number of floors. Do not accept a number less than 10 for the number of rooms on a floor.
#include<iostream>
using namespace std;
int main(){
int n,room,occ,total_occ=0,total_room=0;
// taking number of floors as a input
cout<< "Enter the number of floors (greater then
one)" << endl;
cin >> n;
while(n==1){
cout << "Please enter the
number of floor greater than 1"<< endl;
cin >>n;
}
for(int i=1;i<=n;i++){
if (i==13)
continue;
else{
// taking number
of room as a input
cout <<
"Enter the total number of rooms on the "<< i << "
floor (greater than 10) "<< endl;
cin >>
room;
while(room<10){// if user enter number of room less than
10
cout << "Please enter the number of room
greater than 10"<< endl;
cin >>room;
}
// taking number
of occupied rooms as input
cout <<
"Enter the total number of occupied rooms on the "<< i
<< " floor (less than total number of rooms) "<<
endl;
cin >>
occ;
while(room<occ){// if user enter number of room less than
10
cout << "Please enter the number of
occupied room less than total number of rooms "<< endl;
cin >>occ;
}
// calcuating
total number of rooms
total_room=total_room+room;
// calcuating
total occupied number of rooms
total_occ=total_occ+occ;
}
}
// display total number of rooms in
the hotel
cout << "Total number of
rooms in the hotel " << total_room << endl;
// display total number of
unoccupued rooms in the hotel
cout << "Total number of
unoccupued rooms in the hotel " << total_room-total_occ
<< endl;
// display total number of occupied
rooms in the hotel
cout << "Total number of
occupied rooms in the hotel " << total_occ <<
endl;
// display percentage of occupied
room
float
var=(float(total_occ)/float(total_room));
cout << "Percentage of
occupied room " << var *100 << "%"<<
endl;
}




In C++ Write a program that calculates the occupancy rate for a hotel. The program should...
Write a complete Java program with methods that prompt user for the number of floors, rooms, occupied rooms in a hotel. You must validate floors, rooms, occupied rooms. Compute vacant rooms, occupancy rate on each floor and display rooms, occupied rooms, vacant rooms and occupancy rate for each floor. Use the given method names. See validation rules below: 1. getFloors(). This method prompts user for number of floors in a hotel and returns floors to the caller. 2. testFloors(floors). Do...
I need to output Number of rooms : , Occupied rooms:, Vacant rooms:, and Occupancy rate:, I've written the java program but I can not get the output I need. What am I doing wrong here? This is a java program and I'm not to use anything advanced, just beginner java programming. Any help would be appreciated import java.util.Scanner; // Needed for the Scanner class /** * This program will read in the number of floors the resort * contains...
C ++ Project Description
The BlueMont chain hotels have 4 different types of
room:
Single room: $60/night
Double room: $75/night
King room: $100/night
Suite room: $150/night
The size of the hotel chains in different locations may be
different in terms of the number of floors and the type and the
number of rooms on each floor.
You are required to write a program that calculates the
occupancy rate and the total hotel income for one night and
displays this information as...
**Use C++ **
Project Description
The BlueMont chain hotels have 4 different types of
room:
Single room: $60/night
Double room: $75/night
King room: $100/night
Suite room: $150/night
The size of the hotel chains in different locations may be
different in terms of the number of floors and the type and the
number of rooms on each floor.
You are required to write a program that calculates the
occupancy rate and the total hotel income for one night and
displays this...
***** JAVA ONLY ***** Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. Frist the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the...
5. Create a java application that uses nested loops to collect data and calculate the average rainfall over a peniod of years First the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month, the program should display the number of months, the total...
Write them in python IDLE *****
5. Average Rainfall
Write a program that uses nested loops to collect data
and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop
will iterate once for each year. The inner loop will iterate twelve
times, once for each month. Each iteration of the inner loop will
ask the user for the inches of rainfall for that month. After all
iterations,...
Small Basic Programming Question: Average Score- Write a program that uses loop to collect data and calculate the average score over a number of tests for a number of students. The program should: 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores...
Small Basic Programming Question: Average score Write a program that uses loops to collect data and calculate the average score over a number of tests for a number of students. The program should : 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the...
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should prompt the user for the number of years. Be sure to ask for each months average rainfall for each year. The outer loop will iterate once for each year while the inner loop will iterate 12 times(one time per month) prompting for the months average rainfall on each iteration. Display the number of months, the total inches...