View the step-by-step solution to:

Please complete and submit either the Gradebook problems defined below. Submission Requirements Your submission will consist of a single zip file...

Please complete and submit either the Gradebook problems defined below.

Submission Requirements
Your submission will consist of a single zip file that contains the Java source code files (no .class files!). The files should not be nested in another folder. The files need to compile with a Java 6 compiler and cannot depend on anything more than each other and the Java 6 Library.

Each each class must be contained in its own file and begin with a header of the form

// CLASS :
// ------------------------------------------------------------------------------------------------

Problem - Gradebook

Update the Gradebook system so that you can create instances of MutlipleChoice, Essay, and TeamProject, and add instances of each to the Gradebook for a given student. Further, you can get a weighted average for a given student. That is, evolve the Gradebook classes appropriately so that the following operations, which will be part of Gradebook, work correctly:

public void addAssessment(String studentId, Assessment newAssessment, double weight) { ... }

public double getAverage(String studentId) { ... }
There are several things to consider:

At this point, Gradebook only keeps track of a list of students as an array. To handle assessments, it will also need to handle a list of assessments for each student. To handle this you are going to need to use parallel arrays. So, you would have something like
private Student[] students = new Student[CLASS_SIZE_INCREMENT];

private Assessment[][] assessments = new Assessment[CLASS_SIZE_INCREMENT][];
where what the Assessment list assessments[i] is for the student students[i].

As suggested by the previous point, you are going to need to maintain a list of Assessment references for each student. Consider declaring a constant ASSESSMENT_SIZE_INCREMENT and then when adding a student, not only add it to the student list also create the assessment list. That is, in addStudent(), you will have:
// Add the student to the class if the student is not already enrolled.
if (!isEnrolled) {

// If the array is at capacity, increase its capacity by the increment size.
if (currentEnrollment == students.length) {

Student[] temp = new Student[students.length + CLASS_SIZE_INCREMENT];

System.arraycopy(students, 0, temp, 0, students.length);


students = temp;

// Add the new student to the list.
students[currentEnrollment++] = newStudent;
assessments[currentEnrollment] = new Assessment[ASSESSMENT_SIZE_INCREMENT];

Sign up to view the entire interaction

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question