This is a common type of question to practice for IBDP Computer Science Paper 2 - Java Programming exams 2023.
There are two classes in this situation. Grade and Student. We assume that there will be maximum 25 students in a class.
+--------------------------------------------------------------------+
| Grade |
+--------------------------------------------------------------------+
| - gradeLevel : int |
| - students : Student[] |
+--------------------------------------------------------------------+
| + addStudent(student: Student) : void |
| + removeStudent(student: Student) : void |
| + getStudents() : Student[] |
| + getGradeLevel() : int |
+--------------------------------------------------------------------+
+--------------------------------------------------------------+
| Student |
+--------------------------------------------------------------+
| - name : String |
rollNo : int |
| - age : int |
| - gpa : double |
| - subjects : String[] |
+--------------------------------------------------------------+
| +getName() : String |
| +setName(name : String) : void |
| +getRollNo() : int |
| +setRollNo(rollNo : int) : void |
| +getAge() : int |
| +setAge(age : int) : void |
| +getGpa() : double. |
| +setGpa(gpa : double) : void |
| +getSubjects() : String[] |
| +setSubjects(subjects : String[]) : void |
+--------------------------------------------------------------+
here is a brief explanation of the classes and their methods:
Grade class:
Attributes:
gradeLevel : int - represents the grade level (e.g., 9th grade, 10th grade, etc.)
students : Student[] - an array of Student objects representing the students in the grade.
Methods:
addStudent(student: Student) : void - adds a student to the students array.
removeStudent(student: Student) : void - removes a student from the students array.
getStudents() : Student[] - returns the array of students.
getGradeLevel() : int - returns the gradeLevel.
Student class:
Attributes:
name : String - represents the name of the student.
rollNo : int - represents the roll number of the student.
age : int - represents the age of the student.
gpa : double - represents the GPA of the student.
subjects : String[] - an array of strings representing the subjects the student is enrolled in.
Methods:
getName() : String - returns the name.
setName(name : String) : void - sets the name.
getRollNo() : int - returns the rollNo.
setRollNo(rollNo : int) : void - sets the rollNo.
getAge() : int - returns the age.
setAge(age : int) : void - sets the age.
getGpa() : double - returns the gpa.
setGpa(gpa : double) : void - sets the gpa.
getSubjects() : String[] - returns the subjects.
setSubjects(subjects : String[]) : void - sets the subjects.
Please try this project and post your comments and suggestions
Thanks
Watch video Part 1. IB DP Computer Science HL & SL Exam 2023 Paper 2 by SHAJI PHILIP online without registration, duration hours minute second in high quality. This video was added by user code 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,482 once and liked it 6 people.