In c++ Create a new project named lab9_2. You will continue to use the Courses class, but this time you will create a vector of Courses. The file you will read from is below: 6 CSS 2A 1111 35 CSS 2A 2222 20 CSS 1 3333 40 CSS 1 4444 33 CSS 3 5555 15 CSS 44 6666 12 Read this information into a vector of Courses. Then, print out a summary of your vector. Here's a sample driver: #include #include #include #include #include #include "Course.h" using namespace std; int main() { vector myclass; string dep, c_num; int classes, sec, num_stus; ifstream fin("sample.txt"); if (fin.fail()) { cout << "File path is bad\n"; exit(1); } fin >> classes; for (int i = 0; i < classes; i++) { fin >> dep >> c_num >> sec >> num_stus; // Now how do you create a Course object // that contains the information you just read in // and add it to your myclass vector? } cout << "Here are the college courses: " << endl; for (Course& c : myclass) { c.print(); } return 0; } Sample run: Here are the college courses: ----------------------------- Course: CSS 2A, Section: 1111 Enrolled: 35, Status: Open ----------------------------- Course: CSS 2A, Section: 2222 Enrolled: 20, Status: Open ----------------------------- Course: CSS 1, Section: 3333 Enrolled: 40, Status: Closed ----------------------------- Course: CSS 1, Section: 4444 Enrolled: 33, Status: Open ----------------------------- Course: CSS 3, Section: 5555 Enrolled: 15, Status: Open ----------------------------- Course: CSS 44, Section: 6666 Enrolled: 12, Status: Open

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_2. You will continue to use the Courses class, but this time you will create a vector of Courses. The file you will read from is below:

6
CSS 2A 1111 35
CSS 2A 2222 20
CSS 1 3333 40
CSS 1 4444 33
CSS 3 5555 15
CSS 44 6666 12

Read this information into a vector of Courses. Then, print out a summary of your vector.

Here's a sample driver:

#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <cstdlib>
#include "Course.h"
using namespace std;

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

fin >> classes;

for (int i = 0; i < classes; i++)
{
fin >> dep >> c_num >> sec >> num_stus;
// Now how do you create a Course object
// that contains the information you just read in
// and add it to your myclass vector?
}

cout << "Here are the college courses: " << endl;

for (Course& c : myclass)
{
c.print();
}

return 0;
}

Sample run:

Here are the college courses:
-----------------------------
Course: CSS 2A, Section: 1111
Enrolled: 35, Status: Open
-----------------------------
Course: CSS 2A, Section: 2222
Enrolled: 20, Status: Open
-----------------------------
Course: CSS 1, Section: 3333
Enrolled: 40, Status: Closed
-----------------------------
Course: CSS 1, Section: 4444
Enrolled: 33, Status: Open
-----------------------------
Course: CSS 3, Section: 5555
Enrolled: 15, Status: Open
-----------------------------
Course: CSS 44, Section: 6666
Enrolled: 12, Status: Open
-----------------------------

Expert Solution
steps

Step by step

Solved in 7 steps with 7 images

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