roomset_one.dat 426 25 25 327 18 14 420 20 15 317 100 101 −1 −1 −1 roomset_two.dat 55 10 5 102 12 10 111 15 16 250 20 25 4033 500 207 7810 800 800 8810 800 0

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.

Text files:

  • roomset_one.dat
    • 426 25 25
      327 18 14
      420 20 15
      317 100 101
      −1 −1 −1
  • roomset_two.dat
    • 55 10 5
      102 12 10
      111 15 16
      250 20 25
      4033 500 207
      7810 800 800
      8810 800 0
      -2 -2 -2
  • roomset_three.dat
    • -999

 

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.
6 #include <iostream>
7 #include <fstream>
В #include <string>
9 #include <iomanip>
11 vold ReadRoomData( Int Groom_num, int &max_cap, int Genrolled);
12 vold OutputRoomInfo(double, double, double);
empty_seats);
13
bool DetermineStatus(int
15
15 int main() {
17
18
19
28
21
22
23
24
25
25
27
28
29
30
31
32
33
34
35
36
37
38
39
48
41
42
43
45
46
48
49
38 -
31
37
38
19
01
02
03
04
05}
std::string filename;
//let's create an stream variable
std::ofstream output file;
int room_num;
Intax cap;
int enrolled;
92
93
94
95
96
97 }
int total ax cap = 0;
int total_room- 0;
int total enroll = 0;
int total_over_enroll = 0;
int total_open_enroll = 8;
std::cout << std::setw(8) << std::left << "Room";
std::cout<<std::setw(8) "Capacity";
std::cout <cstd::set(18) < std::left << "Enrolled";
std::cout<<std::setw(13) < std::left<<"Empty Seats";
std::cout<<std::set(9) << std::left << "Statues" << std::endl;
while (true){
ReadRoomData(int Groom_num, int max_cap, int Genrolled);
Lf (room_num < 0){
//return "OPEN";
}
total_room++;
total ax capax cap;
total_enroll + enrolled;
}
else if (max_cap- enrolled > 0){
total_open_enroll++;
}
else if(max cap enrolled <
total_over_enroll++;
}
OutputRoomInfo(room_num, max_cap, enrolled);
std::cout<***********
std::cout << "Rooms:total_room << std::endl;
std::cout << "Overall Capacity:
std::cout << "Total Enrollment: << total enroll <std::endl;
std::cout<<"Number of OVER Enrolled Rooms:
std::cout<<"Number of OPEN Rooms Available:
std::cout << ************
06
67 - vold ReadRoomData(double room_num, double Smax_cap, double enrolled){
08
std::cin> ;
if (room_num < 0){
return;
}
78
71
72 stdictax_cap;
73
std::cin>>enrolled; ///check if they need to be before or after brackets
total_max_cap << std::endl;
74}
75
76 - vold OutputRoomInfo(int room, int max_cap, int enrolled){
77
//int empty_seats-max_cap- enrolled; //max.capacity - enrolled empty seats
78
79
80
81 std::cout<<std::setw(10)
82
83
84})
85
36 bool DetermineStaus(int empty_seats}{
if(empty_seats > 0){
87
88
return "OPEN";
89
90 -
91
}
}
else if (empty_seats - 8}{
return "FULL";
}
else{
total_over_enroll << std::endl;
std::endl;
*******
int empty_seats DetermineStatus(max_cap enrolled);
std::cout << std::setw(8) << std::left << room;
stdright
std::cout << std::setw(8) << std::right
std::cout << std::setw(11) << std::right << DetermineStatus(max cap enrolled) << std::endl;
return "OVER";
max_cap;
enrolled;
Transcribed Image Text:6 #include <iostream> 7 #include <fstream> В #include <string> 9 #include <iomanip> 11 vold ReadRoomData( Int Groom_num, int &max_cap, int Genrolled); 12 vold OutputRoomInfo(double, double, double); empty_seats); 13 bool DetermineStatus(int 15 15 int main() { 17 18 19 28 21 22 23 24 25 25 27 28 29 30 31 32 33 34 35 36 37 38 39 48 41 42 43 45 46 48 49 38 - 31 37 38 19 01 02 03 04 05} std::string filename; //let's create an stream variable std::ofstream output file; int room_num; Intax cap; int enrolled; 92 93 94 95 96 97 } int total ax cap = 0; int total_room- 0; int total enroll = 0; int total_over_enroll = 0; int total_open_enroll = 8; std::cout << std::setw(8) << std::left << "Room"; std::cout<<std::setw(8) "Capacity"; std::cout <cstd::set(18) < std::left << "Enrolled"; std::cout<<std::setw(13) < std::left<<"Empty Seats"; std::cout<<std::set(9) << std::left << "Statues" << std::endl; while (true){ ReadRoomData(int Groom_num, int max_cap, int Genrolled); Lf (room_num < 0){ //return "OPEN"; } total_room++; total ax capax cap; total_enroll + enrolled; } else if (max_cap- enrolled > 0){ total_open_enroll++; } else if(max cap enrolled < total_over_enroll++; } OutputRoomInfo(room_num, max_cap, enrolled); std::cout<*********** std::cout << "Rooms:total_room << std::endl; std::cout << "Overall Capacity: std::cout << "Total Enrollment: << total enroll <std::endl; std::cout<<"Number of OVER Enrolled Rooms: std::cout<<"Number of OPEN Rooms Available: std::cout << ************ 06 67 - vold ReadRoomData(double room_num, double Smax_cap, double enrolled){ 08 std::cin> ; if (room_num < 0){ return; } 78 71 72 stdictax_cap; 73 std::cin>>enrolled; ///check if they need to be before or after brackets total_max_cap << std::endl; 74} 75 76 - vold OutputRoomInfo(int room, int max_cap, int enrolled){ 77 //int empty_seats-max_cap- enrolled; //max.capacity - enrolled empty seats 78 79 80 81 std::cout<<std::setw(10) 82 83 84}) 85 36 bool DetermineStaus(int empty_seats}{ if(empty_seats > 0){ 87 88 return "OPEN"; 89 90 - 91 } } else if (empty_seats - 8}{ return "FULL"; } else{ total_over_enroll << std::endl; std::endl; ******* int empty_seats DetermineStatus(max_cap enrolled); std::cout << std::setw(8) << std::left << room; stdright std::cout << std::setw(8) << std::right std::cout << std::setw(11) << std::right << DetermineStatus(max cap enrolled) << std::endl; return "OVER"; max_cap; enrolled;
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
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Binary numbers
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
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