In C++    Create a new project named lab9_1 . You will need to implement a Course class. Here is its UML diagram: Course - department  : string - course_num : string - section     : int - num_students : int - is_full     : bool + Course() + Course(string, string, int, int) + setDepartment(string) : void + setNumber(string) : void + setSection(int) : void + setStudents(int) : void + getDepartment() const : string + getNumber() const : string + getSection() const : int + getStudents() const : int + print() const : void  Create a sample file to read from: CSS 2A 1111 35 Additional information: The Course class has two constructors. Make sure you have default values for your default constructor. Each course maxes out at 40 students. Therefore, you need to make sure that there aren’t more than 40 students in a Course. You can choose how you handle situations where more than 40 students are added. Additionally, you should automatically set is_full to false or true, based on the number of students. If you’d like to include additional methods than those found in the UML diagram, feel free to do so. That’s just the minimum amount required, but helper/utility methods would be okay. You will also make use of the const keyword to indicate which methods are not modifying the object. You will read in the information from the file, and declare a Course object to store this data. Then you will print a summary of the course. Then, modify st_enrolled to have 40 student (just use setStudents() method), and then print the summary once more. Your main function may start out: Course myclass; string dep, c_num; int sec, num_stus; ifstream fin("file.txt"); if(fin.fail()) { cout << "File path is bad\n"; exit(1); } fin >> dep >> c_num >> sec >> num_stus; fin.close(); myclass.setDepartment(dep); myclass.setNumber(c_num); //and continue Sample run: ----------------------------- Course: CSS 2A, Section: 1111 Enrolled: 35, Status: Open ----------------------------- Another sample run (notice since class is full, Status is set to closed): ----------------------------- Course: CSS 2A, Section: 1111 Enrolled: 40, Status: Closed -----------------------------

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

In C++

 

 Create a new project named lab9_1 . You will need to implement a Course class. Here is its UML diagram:

Course
- department  : string
- course_num : string
- section     : int
- num_students : int
- is_full     : bool
+ Course()
+ Course(string, string, int, int)
+ setDepartment(string) : void
+ setNumber(string) : void
+ setSection(int) : void
+ setStudents(int) : void
+ getDepartment() const : string
+ getNumber() const : string
+ getSection() const : int
+ getStudents() const : int
+ print() const : void

 Create a sample file to read from:

CSS 2A 1111 35

Additional information:

  1. The Course class has two constructors. Make sure you have default values for your default constructor.

  2. Each course maxes out at 40 students. Therefore, you need to make sure that there aren’t more than 40 students in a Course. You can choose how you handle situations where more than 40 students are added. Additionally, you should automatically set is_full to false or true, based on the number of students.

  3. If you’d like to include additional methods than those found in the UML diagram, feel free to do so. That’s just the minimum amount required, but helper/utility methods would be okay.

  4. You will also make use of the const keyword to indicate which methods are not modifying the object.

  5. You will read in the information from the file, and declare a Course object to store this data. Then you will print a summary of the course. Then, modify st_enrolled to have 40 student (just use setStudents() method), and then print the summary once more.

Your main function may start out:

Course myclass;
string dep, c_num;
int sec, num_stus;
ifstream fin("file.txt");
if(fin.fail())
{
cout << "File path is bad\n";
exit(1);
}

fin >> dep >> c_num >> sec >> num_stus;

fin.close();

myclass.setDepartment(dep);
myclass.setNumber(c_num);

//and continue

Sample run:

-----------------------------
Course: CSS 2A, Section: 1111
Enrolled: 35, Status: Open
-----------------------------

Another sample run (notice since class is full, Status is set to closed):

-----------------------------
Course: CSS 2A, Section: 1111
Enrolled: 40, Status: Closed
-----------------------------

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
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