Quiz 4. Aggregation Computing Fundamentals II Quiz 4. Creating a Class Course Guide ● Make a folder “Quiz4”. Put all your files in this “Quiz4” directory ● Commit/Push your files every 10 minutes or...

1 answer below »
C++, use the simple way to solve it, contain main.cpp, Student.cpp and hpp, Course.cpp and hpp with 2 texts file.


Quiz 4. Aggregation Computing Fundamentals II Quiz 4. Creating a Class Course Guide ● Make a folder “Quiz4”. Put all your files in this “Quiz4” directory ● Commit/Push your files every 10 minutes or on every major change so that the updates history are saved in the commit log. It may not be graded without frequent commits. ● Submit your program source files to Github Classroom ○ https://classroom.github.com/a/pfXx-OTa ○ (Links to an external site.) ○ ● Submit the elaboration on your program to Canvas [1] Create a class Course and Aggregated Class Student. In this question, we will design the class Course. This Course class has an aggregated Class Student. We will use the Class Course to store the course information and also the list of the students who enrolled in this class. For example, this figure shows the course “CS01” has 4 credits and opened in Fall 2019 semester. There are 5 enrolled students in this course and they have the following scores and grades. CS01 4 Fall2019 Student ID Credit Grade Score 1001 John A 99 1002 Kurt B 89 1003 Bill A 99 1004 Jim A 99 1005 Bob C 79 1 https://classroom.github.com/a/pfXx-OTa https://classroom.github.com/a/pfXx-OTa [Requirements] ● Create all accessor/mutator functions for each class ● Constructor for each class ○ Create the default constructor (without parameter) ○ Create the constructor to set all private member variables ○ e.g) vector slist; Course(“CS01”, 3, “Fall2019”, slist); Student(1001, “John”, ‘A’, 90.0); ● Make the member function to add Student object instance to the “student” member data of the Class Course. ○ void Course::addStudent(Student &s); ● Make the member function to set the all private member data of Course ○ Course::setCourse(“CS01”, 3, “Fall2019”, slist); ○ Student::setStudent(1001, “John”, ‘A’, 95.5); ● Static variable for the number of Courses ○ When the Course instance is created, NUM_COURSES should be increased by 1 ● Static function to get the number of Courses NUM_COURSES ○ When you print all Course information, this function will be helpful to make the for-loop. ● Overloading operator >> of istream for Course class 2 ○ to read Student information from the text file ○ to fill up the object instance value ○ Course c; ○ ifs >> c; ● Overloading operator < of="" ostream="" for="" course="" class="" ○="" cout="">< c;="" ○="" (name,="" dob,="" the="" list="" of="" course="" details)="" ○="" when="" we="" use="" the="" “cout”="" with="" the="" course="" object,="" the="" program="" must="" show="" all="" information="" that="" is="" included="" in="" the="" course="" object="" like="" below="" cs01="" 4="" fall2019="" student="" id="" credit="" grade="" score="" 1001="" john="" a="" 99="" 1002="" kurt="" b="" 89="" 1003="" bill="" a="" 99="" 1004="" jim="" a="" 99="" 1005="" bob="" c="" 79="" here="" is="" the="" example="" code="" for="" main="" function.="" ifs.open("coursestudents.txt");="" for="" (int="" i="0;" i="">< n;="" i++)="" {="" ifs="">> courses[i]; cout < courses[i]="">< endl;="" }="" 3="" https://github.com/kwooley/cs01/blob/master/ch14/quiz4/coursestudents.txt="" ●="" the="" second="" file="" “addstudents.txt”="" cs02="" 5="" 2001="" nick="" a="" 99.0="" 2002="" doe="" b="" 89.0="" 2003="" mike="" c="" 75.0="" 1003="" bill="" a="" 99.0="" 1004="" jim="" a="" 99.0="" cnt02="" 3="" 1006="" kate="" d="" 69.5="" 1007="" jan="" w="" 0.0="" 1008="" amy="" c="" 78.5="" ●="" this="" file="" contains="" the="" list="" of="" students="" to="" add="" the="" course.="" ○="" 1st="" line="" :="" cs02="" ;="" denotes="" the="" course="" name="" ○="" 2nd="" line:="" the="" number="" of="" students="" to="" add="" to="" the="" course.student="" ○="" line="" 3="" ~="" 7="" :="" the="" students="" information="" to="" add="" the="" course="" cs02="" ●="" make="" the="" program="" code="" to="" read="" this="" file="" ●="" and="" then="" add="" the="" students="" to="" the="" corresponding="" course="" object.="" ●="" here="" is="" the="" pseudo="" code="" for="" adding="" students.="" ifs.open("addstudents.txt");="" while="" (="" for="" all="" courses="" )="" {="" course_id="Find" the="" course="" id="" to="" add="" the="" student="" for="" (="" all="" students="" in="" the="" course="" )="" {="" read="" each="" student="" information="" and="" cook="" the="" struct="" student="" s.setstudent(id,="" sname,="" grade,="" sc);="" courses[course_id].addstudent(s);="" }="" cout="">< "updated="" students="" list="" for="" the="" course="" "="">< cname="">< endl;="" cout="">< courses[course_id]="">< endl; } ● make the three files for this quiz. ○ main.cpp : for the main function 4 https://github.com/kwooley/cs01/blob/master/ch14/quiz4/addstudents.txt ○ student.hpp: // design the class student ○ course.hpp : // design the class course ● in main, ○ open (“coursestudents.txt”) file ○ read all lines and construct the class course object array ○ close the file ○ open(“addstudents.txt”) file ○ read all contents and construct the struct student. add them to corresponding course object. ○ print all course ( use the static variable num_courses to make the for loop) submit your program source files to github classroom ● https://classroom.github.com/a/pfxx-ota submit the elaboration on your program to canvas 5 https://classroom.github.com/a/pfxx-ota cs02 5 2001nicka 99.0 2002 doe b 89.0 2003mike c 75.0 1003billa 99.0 1004jim a 99.0 cnt02 3 1006 kated 69.5 1007 jan w 0.0 1008amy c 78.5 cs014fall2019 5 1001johna 99.0 1002kurtb 89.0 1003billa 99.0 1004jim a 99.0 1005bob c 79.0 cs024spring2020 10 1001johna 99.0 1002kurtb 89.0 1003billa 99.0 1004jim a 99.0 1005bob c 79.0 1006 kated 69.5 1007 jan w 0.0 1008amy c 78.5 2001nicka 99.0 2002 doe b 89.0 cis014fall2021 5 2001nicka 99.0 2002 doe b 89.0 2003mike c 75.0 1010 bob d 65.0 3001 white b 85.0 cnt024fall2021 5 1001johna 99.0 1002kurtb 89.0 2001nicka 99.0 2002 doe b 89.0 3001 white b 85.0 endl;="" }="" ●="" make="" the="" three="" files="" for="" this="" quiz.="" ○="" main.cpp="" :="" for="" the="" main="" function="" 4="" https://github.com/kwooley/cs01/blob/master/ch14/quiz4/addstudents.txt="" ○="" student.hpp:="" design="" the="" class="" student="" ○="" course.hpp="" :="" design="" the="" class="" course="" ●="" in="" main,="" ○="" open="" (“coursestudents.txt”)="" file="" ○="" read="" all="" lines="" and="" construct="" the="" class="" course="" object="" array="" ○="" close="" the="" file="" ○="" open(“addstudents.txt”)="" file="" ○="" read="" all="" contents="" and="" construct="" the="" struct="" student.="" add="" them="" to="" corresponding="" course="" object.="" ○="" print="" all="" course="" (="" use="" the="" static="" variable="" num_courses="" to="" make="" the="" for="" loop)="" submit="" your="" program="" source="" files="" to="" github="" classroom="" ●="" https://classroom.github.com/a/pfxx-ota="" submit="" the="" elaboration="" on="" your="" program="" to="" canvas="" 5="" https://classroom.github.com/a/pfxx-ota="" cs02="" 5="" 2001="" nick="" a="" 99.0="" 2002="" doe="" b="" 89.0="" 2003="" mike="" c="" 75.0="" 1003="" bill="" a="" 99.0="" 1004="" jim="" a="" 99.0="" cnt02="" 3="" 1006="" kate="" d="" 69.5="" 1007="" jan="" w="" 0.0="" 1008="" amy="" c="" 78.5="" cs01="" 4="" fall2019="" 5="" 1001="" john="" a="" 99.0="" 1002="" kurt="" b="" 89.0="" 1003="" bill="" a="" 99.0="" 1004="" jim="" a="" 99.0="" 1005="" bob="" c="" 79.0="" cs02="" 4="" spring2020="" 10="" 1001="" john="" a="" 99.0="" 1002="" kurt="" b="" 89.0="" 1003="" bill="" a="" 99.0="" 1004="" jim="" a="" 99.0="" 1005="" bob="" c="" 79.0="" 1006="" kate="" d="" 69.5="" 1007="" jan="" w="" 0.0="" 1008="" amy="" c="" 78.5="" 2001="" nick="" a="" 99.0="" 2002="" doe="" b="" 89.0="" cis01="" 4="" fall2021="" 5="" 2001="" nick="" a="" 99.0="" 2002="" doe="" b="" 89.0="" 2003="" mike="" c="" 75.0="" 1010="" bob="" d="" 65.0="" 3001="" white="" b="" 85.0="" cnt02="" 4="" fall2021="" 5="" 1001="" john="" a="" 99.0="" 1002="" kurt="" b="" 89.0="" 2001="" nick="" a="" 99.0="" 2002="" doe="" b="" 89.0="" 3001="" white="" b="">
Answered Same DayDec 15, 2021

Answer To: Quiz 4. Aggregation Computing Fundamentals II Quiz 4. Creating a Class Course Guide ● Make a folder...

Vaibhav answered on Dec 15 2021
120 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here