0% found this document useful (0 votes)
13 views1 page

Quiz 1

Uploaded by

belalwaheedali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Quiz 1

Uploaded by

belalwaheedali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Practical Quiz

Name: ………………………………………… ID:……………………………..

Create a program that models a Student and Course.

1. Course Class

 Attributes:
o courseName (string)
o courseCode (string)
o credits (int)

Requirements:

 Constructors:
1. Default constructor.
2. Parameterized constructor to initialize all attributes.
 Setters and Getters for all attributes.

2. Student Class

 Attributes:
o name (string)
o studentID (string)
o courses (array of Course objects of size 10)

Requirements:

 Constructors:
1. Default constructor.
2. Parameterized constructor to initialize name and studentID.

 Setters and Getters for all attributes.


 addCourse(): Adds a Course to the student's course list.
 Overload the += operator to add a Course to the Student.

Hint: before adding course to array, first check if there is a place to add it , and also check if sent
course already in the array of not , you can compare strings using compare method in string.h
header or using ==

Example Scenario:

1. Create at least two Course objects.


2. Create a Student object.
3. Use the overloaded += operator to add the Course objects to the student.
4. Display student information with all registered course

You might also like