$25
Introduction
The aim of this take-home exam is to practice on the basics of C++ (input, output, assignment, arithmetic, etc.) and decision making (conditional if-else statements). The use of if-else statements is due to the nature of the problem; that is, you cannot finish this take-home exam without using decision making.
witnessing the return to campus and face-to-face lectures. However, the hazards and risks of Covid-19 still exist. Although lectures have returned to classrooms, restrictions have been applied to conform with social-distancing rules. Classroom capacities have been reduced to a percentage of their original capacity. In this take-home exam, you will implement a C++ program that performs calculations to determine whether all registered students can attend face-to-face lectures in the classroom. In the cases where not all registered students can attend the physical lecture, the program should also calculate how many students must be selected to attend on Zoom. The inputs to the program are below:
1. Name of classroom
2. Original room capacity
3. Coefficient (percentage) of allowed capacity
4. Number of students registered
You may implement your algorithm all in the main function, i.e. you are not expected to write any user-defined functions, but of course you can write some, if you prefer to do so.
Inputs, Flow of the Program and Outputs
The inputs of the program and their order are explained below. It is extremely important to follow this order with the same characters since we automatically process your programs. Thus, your work will be graded as 0 unless the order is entirely correct. Please see the "Sample Runs" section for some examples.
The prompts of the input statements to be used has to be exactly the same as the prompts of the "Sample Runs".
At the beginning of your program, the user will be first prompted to enter the name of the classroom. The name of the classroom should be displayed in the final output after doing the necessary calculation. Please see the "Sample Runs" section for some examples.
Next, the user will be asked to provide the original room capacity. This number indicates how many students this classroom can fit before the applied restrictions. You should do an input check on the original room capacity such that if the user enters a negative number, the program should display an error message saying “You have entered an invalid value for room capacity.” and then end the program.
Then, the program should take the allowed capacity coefficient input. This input represents the percentage of the original capacity that the classroom can fit. This value will be used to calculate the maximum number of students that can be allowed into the classroom using the following formula:
allowed_capacity = original_capacity * coefficient
Coefficient value needs to represent a percentage in the following range: 0% < percentage ≤ 100%. You should do an input check to make sure the value falls into that range otherwise, the program should display an error message saying “You have entered an invalid value for capacity coefficient.” and then end the program.
If the coefficient input matches the criteria above the program will then take the final input: number of students registered. You should do an input check on the number of students registered such that if the user enters a negative number, the program should display an error message saying “You have entered an invalid value for registered students.” and then end the program. This number will be used to determine whether all registered students can fit by comparing the value with the allowed capacity. If all registered students can attend the physical lecture, the program should print an appropriate message. Otherwise, the program should calculate how many registered students should be selected to attend the zoom lecture since the classroom has reached its maximum capacity (after applying capacity reduction). This number can be calculated simply by the following formula:
zoom_students = registered_students - allowed_capacity
Then, it should print the amount along with an appropriate message.
Please refer to the "Sample Runs" section for some examples and further details.