Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ 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

image text in transcribed

c++

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 Exercise Objectives Define class Problem Description You are supposed to declare and implement Course class as follows: A class called Course (as shown in the class diagram) contains: o Member variables to store the course ID (int), course department (String), course name (String), the number of students that register in this class and which students are they. Note that the number of students is unknown and can vary from course to another. ID variable should be constant and automatically increase starting by 700. Such as first object's id is 700, second object id is 701...and so on. O A Course class constructor that receives course name and course department. o Copy constructor course CID: const int dept: string name: string - noOfStd: int *Students(): Student + course(string name, string dept) + course (course &c) + coursel) + SetStudents Student [student, int noOfStd): void + getDept():string + getName(): string + getNoStd(): int + setDept():void + setName(): void + setNoStd(): void Page 2 of 3 o 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. A Destructor for course Class. Setters and getters for course department, course name, and number of students. Make all getters constant functions. o A friend function float GetAvgGrade (course & c) that returns the average of all students' grade in a course. Exercise 3- Implement Main Exercise Obiectives 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). StudentcsStudents[4]={{"Ali", 54,77},{"Ahmad", 27,84},{"Maria", 36,91}, {"Mira" 15,68}}; Student MISStudents[3]={{"Maher", 20,80},{"sally", 40,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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago