Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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. Exercse 2-Define Course Class Exercise ohlective Define class course Problem Description You are supposed to declare and implement Course class as follows: A class called Course (as shown in the class diagram) contains: 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. A Course class constructor that receives course name and course department. Copy constructor. cID: const int dept: string name: string - noofstd: int *Students(): Student + course(string name, string dept) + course (course & c) + -course() + SetStudents ( Student ( student, int noofstd): void + getDept():int + getName(): int + getNoStd(): int + setDept():int + setName(): int + setNoStd(): Int Page 2 of 3 0 0 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 gelters constant functions. A friend function float GetAvgGrade (course & e) that returns the average of all students' grade In a course. Exercise 3 - Implement Maln 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 Numof Hours (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]={{"A11",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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

How has social media emerged as an important force in recruiting?

Answered: 1 week ago

Question

=+8. Why is productivity important?

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago

Question

=+6. What does the invisible hand of the marketplace do?

Answered: 1 week ago