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
icon
Related questions
Question

I need help in a C++ program. I'm not sure what to do add next.

 

Program Requirements

  1. DO NOT open the file and use it within your program (input redirection)

    • Example of input redirection: ./a.out < roomset_one.dat
  2. 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
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";
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education