Question: In this assignment, you will develop a program that can be used by a teacher to record the student grades in his/her courses. The class

In this assignment, you will develop a program that can be used by a teacher to record the student grades in his/her courses. The class diagram is given below.

Please note the following:

  • A students grade is an integer value that is between 0 and 100, inclusive.
  • You should apply the information hiding principle when necessary.
  • Instance variables whose values do not change after being initialized must be declared final e.g., name.
  • Use toString() in class Student to print the relevant objects information.
  • You should define the constructors as specified. Validate the values of the instance variables when necessary.
  • Method getCourseAverage() should return 0 if there is no student in the course.
  • Method addStudent(Sudent s) should return false if the student s cannot be added. A student cannot be added to a course if the course is full or if the student has already been added since no two students in a course can have the same name.
  • Method getBestStudent() should return a student with the best grade in the course. If there is no student in the course, the method should return null.
  • Method printStudents() should print the students in the course. For each student, print the following: the name and the grade.
  • In the constructor of the class Course, define the array students as follows:

students = new Student[10];

We will assume that the maximum capacity of the course is 10 students.

Create a test class named CourseTest which contains the main method. In it, create several classes with several arbitrary students. Test your program and ensure that the results are correct.

In this assignment, you will develop a program that can be used

Course Student - students: Student [] -name: String -grade: int > Course + getCourse Average(): int + getBestStudent(): Student + addStudent(Students): boolean + printStudents() > Student name: String, grade:int) + setGrade/grade:int) + getGrade(); int + toString(): String Course Test

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!