Answered step by step
Verified Expert Solution
Question
1 Approved Answer
important please do it as needed 5 files and it's c++ and will be better if using online GDB compiler. Lab Exercises This assignment consists
important please do it as needed 5 files and it's c++ and will be better if using online GDB compiler.
Lab Exercises This assignment consists of three exercises. You should submit your code in five files on the e-learning: two header file (h) for two classes, three CPP source files (.cpp) for classes implementation and the main function. Also, in your header file, you must prevent multiple file inclusion. Your code should use separate implementation of the class. Exercise 1 - Define Student Class Exercise Objectives Define class Problem Description You will develop the one header file (student.h) and one CPP source file (student.cpp) in this exercise. Define and implement a class called student contains: Three private variables: noOfHour (int), grade (int), and name (string). You should ensure that both noOfHour and grade greater than 0. Default and parametrized constructor. One destructor. Getter and setter functions. Exercise 2 - Define Course Class course Exercise Objectives Define class Problem Description CID: const int You are supposed to declare and implement Course-dept: string class as follows: -name: string A class called Course (as shown in the class - noOfStd: int diagram) contains: Students[]: Student Member variables to store the course ID + course(string name, string dept) (int), course department (String), course + course (course & c) name (String), the number of students that + "course() register in this class and which students + SetStudents ( Student student, int noOfStd): void are they. Note that the number of students + getDept():int is unknown and can vary from course to getName(); int another. ID variable should be constant getNoStd(); int and automatically increase starting by setDept():int 700. Such as first object's id is 700, second setName(): int object id is 701...and so on. + setNoStd(): int O A Course class constructor that receives course name and course department. o Copy constructor. Page 2 of 3 A member function SetStudents() which sets the students for course according to received array of students std. Note that this function can be used to change the students as well. o A Destructor for course Class. o Setters and getters for course department, course name, and number of students. O Make all getters constant functions. A friend function float GetAvgGrade (course & c) that returns the average of all students' grade in a course. Exercise 3 - Implement Main Exercise Objectives Declare objects Use constructor and destructor Problem Description Write the main function: Create an array of 4 students called CsStudents (Ali, Ahmad, Maria, and Mira) with NumofHours (54, 27, 36, 15), and Grade (77, 84, 91, 68). Create an array of 3 students called MISStudents (Maher, sally, and tala) with NumofHours (20, 40, 12), and Grade (80, 84,95). Students Students[4]={{"Ali", 54,77},{"Ahmad",27,84},{"Maria",36,91},{"Mira" 15,68}); Student MisStudents[3]={{"Maher", 20,80},{"sally", 48,84}, { "tala", 12,95}}; Create two Course objects (CPlusPlus, and WEB), let the user fill their other information such as department and name Set the CSStudents to the WEB, and Misstudents to the CPlusPlus. Print out the average grade of each course. Write the code to ask the user of how many students he/she want to register, then create an array of students based on his input and let him/her fill their information. Replace the students in CPlusPlus, with the students entered by user in the previous step
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started