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
Смотрите видео Part 1. IB DP Computer Science HL & SL Exam 2023 Paper 2 by SHAJI PHILIP онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь code 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,482 раз и оно понравилось 6 людям.