st include the following functions: ReadRoomData: a void function that accepts three reference parameters (the room number, max capacity, and enrolled). It should read in all three values from stdin. DetermineStatus: a value-returning
st include the following functions: ReadRoomData: a void function that accepts three reference parameters (the room number, max capacity, and enrolled). It should read in all three values from stdin. DetermineStatus: a value-returning
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
I need help in a C++ program. I'm not sure what to do add next.
Program Requirements
-
DO NOT open the file and use it within your program (input redirection)
- Example of input redirection: ./a.out < roomset_one.dat
-
You must include the following functions:
- ReadRoomData: a void function that accepts three reference parameters (the room number, max capacity, and enrolled). It should read in all three values from stdin.
- DetermineStatus: a value-returning function that has one parameter (available enrollment). It should return a std::string containing the status of the room (OPEN, FULL, OVER)
- OutputRoomInfo: a void function that accepts three value parameters (room, max capacity, and enrolled). It should call DetermineStatus and output the formatted room information for that single set of data.
![1. Sample Run 1
~/Open-Lab-2$ ./a.out roomset_one.dat
Room Capacity Enrolled Empty Seats
420
327
420
317
***********
25
18
20
100
~/Open-Lab-2$
2. Sample Run 2
******
Rooms: 4
Overall Capacity: 103
Total Enrollment: 155
Number of OVER Enrolled Rooms: 1
Number of OPEN Rooms Available: 2
10
12
15
20
500
800
800
25
14
15
101
*************
~/Open-Lab-2$
3. Sample Run 3
0
4
~/Open-Lab-2$ ./a.out roomset_two.dat
Room Capacity Enrolled Empty Seats
55
102
111
250
4033
7810
8810
3
-1
3
10
10
25
207
800
0
~/Open-Lab-2$
Rooms: 7
Overall Capacity: 2157
Total Enrollment: 100:
Number of OVER Enrolled Rooms: 2
Number of OPEN Rooms Available: 4
5
2
-1
-5
293
0
800
Status
FULL
OPEN
OPEN
OVER
Status
OPEN
OPEN
OVER
OVER
OPEN
FULL
OPEN
*******
**********
~/Open-Lab-2$ ./a.out < roomset_three.dat
Room Capacity Enrolled Empty Seats Status
*******
********
Rooms: 0
Overall Capacity: 0
Total Enrollment: 0
Number of OVER Enrolled Rooms: 0
Number of OPEN Rooms Available: 0
**************
*******
G](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3eb03a80-7cae-4d33-b228-e2e0361c370e%2Fdfe321cb-682a-4068-8a43-30b50cf03894%2Fjmbvhp_processed.png&w=3840&q=75)
Transcribed Image Text:1. Sample Run 1
~/Open-Lab-2$ ./a.out roomset_one.dat
Room Capacity Enrolled Empty Seats
420
327
420
317
***********
25
18
20
100
~/Open-Lab-2$
2. Sample Run 2
******
Rooms: 4
Overall Capacity: 103
Total Enrollment: 155
Number of OVER Enrolled Rooms: 1
Number of OPEN Rooms Available: 2
10
12
15
20
500
800
800
25
14
15
101
*************
~/Open-Lab-2$
3. Sample Run 3
0
4
~/Open-Lab-2$ ./a.out roomset_two.dat
Room Capacity Enrolled Empty Seats
55
102
111
250
4033
7810
8810
3
-1
3
10
10
25
207
800
0
~/Open-Lab-2$
Rooms: 7
Overall Capacity: 2157
Total Enrollment: 100:
Number of OVER Enrolled Rooms: 2
Number of OPEN Rooms Available: 4
5
2
-1
-5
293
0
800
Status
FULL
OPEN
OPEN
OVER
Status
OPEN
OPEN
OVER
OVER
OPEN
FULL
OPEN
*******
**********
~/Open-Lab-2$ ./a.out < roomset_three.dat
Room Capacity Enrolled Empty Seats Status
*******
********
Rooms: 0
Overall Capacity: 0
Total Enrollment: 0
Number of OVER Enrolled Rooms: 0
Number of OPEN Rooms Available: 0
**************
*******
G
![3
4
3
0 #include <iostream>
7 #include <fstream>
8
#include <string>
9
10
void ReadRoomData(int &read, int &max_cap, int &enrolled);
11 void OutputRoomInfo(double, double, double);
12 bool Determinestatus(int
empty_seats);
13
14
15
10
17
18
19
20
NNNNNANAMANS
21
22
23
24
25
20
27
28
29
30
31
//Description: Ask user for input regarding room #, maximum capacity of room, and current # of students enrolled
32
30
int main() {
38
}
int room_num;
int max_cap;
int enrolled;
std::string filename;
//let's create an fstream variable
std::ifstream input_file;
void ReadRoomData(double &room_num, double &max_cap, double enrolled) {
}
33
34 void OutputRoomInfo(int room, int max_cap, int enrolled) {
int empty = max_cap - enrolled;
35
}
std::cout <<
37 std::string status = Determinestatus(int empty_seats)
42
43
44
45
40
47 ✔
48
49
30
31 }
std::cin>>
39
40 ✓ bool Determinestaus (int empty_seats) {
if(empty_seats > 0) {
41✓
return "OPEN";
}
else if (empty_seats == 0){
return "FULL";
}
else{
}
return "OVER";](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3eb03a80-7cae-4d33-b228-e2e0361c370e%2Fdfe321cb-682a-4068-8a43-30b50cf03894%2F6lefs0m_processed.png&w=3840&q=75)
Transcribed Image Text:3
4
3
0 #include <iostream>
7 #include <fstream>
8
#include <string>
9
10
void ReadRoomData(int &read, int &max_cap, int &enrolled);
11 void OutputRoomInfo(double, double, double);
12 bool Determinestatus(int
empty_seats);
13
14
15
10
17
18
19
20
NNNNNANAMANS
21
22
23
24
25
20
27
28
29
30
31
//Description: Ask user for input regarding room #, maximum capacity of room, and current # of students enrolled
32
30
int main() {
38
}
int room_num;
int max_cap;
int enrolled;
std::string filename;
//let's create an fstream variable
std::ifstream input_file;
void ReadRoomData(double &room_num, double &max_cap, double enrolled) {
}
33
34 void OutputRoomInfo(int room, int max_cap, int enrolled) {
int empty = max_cap - enrolled;
35
}
std::cout <<
37 std::string status = Determinestatus(int empty_seats)
42
43
44
45
40
47 ✔
48
49
30
31 }
std::cin>>
39
40 ✓ bool Determinestaus (int empty_seats) {
if(empty_seats > 0) {
41✓
return "OPEN";
}
else if (empty_seats == 0){
return "FULL";
}
else{
}
return "OVER";
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education