0% found this document useful (0 votes)
30 views2 pages

Quiz 1 Copy4

Uploaded by

alaaelk943
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)
30 views2 pages

Quiz 1 Copy4

Uploaded by

alaaelk943
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/ 2

Practical Quiz

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

Problem Statement:

Create a program that models a University System with Student, Course, and Department classes.

1. Course Class

Attributes:

 courseName (string): The name of the course.


 courseCode (string): A unique code for the course.
 credits (int): The number of credits for the course.
 grade (char): Grade received in the course ('A', 'B', 'C', 'D', 'F').

Requirements:

1. Constructors:
o Default constructor.
o Parameterized constructor to initialize all attributes.
2. Setters and Getters for all attributes.
3. gradePoint(): Returns the grade point value:
o 'A' = 4, 'B' = 3, 'C' = 2, 'D' = 1, 'F' = 0.

2. Student Class

Attributes:

 studentName (string): The name of the student.


 studentID (string): A unique ID for the student.
 courses (array of Course objects with a size of 5): Courses the student is enrolled in.
 courseCount (int): Tracks the number of courses a student is enrolled in.

Requirements:

1. Constructors:
o Default constructor.
o Parameterized constructor to initialize studentName and studentID.
2. addCourse(): Adds a Course to the student's list.
Hint: before adding course check if there is a space to add it
3. > operator which compare student GPA and return true if first student GPA is greater otherwise return
false
4. displayCourses(): Displays all the courses the student is enrolled in(courseCode, courseName)
5. calculateTotalCredits(): Returns the total credits the student is enrolled in.
6. calculateGPA(): Calculates and returns the GPA using the formula:
Practical Quiz
Name: ………………………………………… ID:……………………………..

3. Department Class
Attributes:
 departmentName (string): The name of the department.
 students (array of Student objects with size 100): Array of students in the department.
 studentCount (int): Tracks the number of students in the department.
Requirements:
1. Constructors:
o Parameterized constructor to initialize departmentName.
2. += Adds a Student to the department's student list.
Hint: before adding student check if there is a space to add it
3. displayStudents(): Displays all students and their GPAs.
Example Scenario:
1. Create three Course objects with assigned grades and credits.
2. Create two Student objects and add courses to each student.
3. Create a Department object and add the students to it.
4. Compare two student GPA then print student name who has greater gpa
5. Display the list of students with their total credits and GPA using displayStudents().

You might also like