Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started