Question: help me with this class instructions: The CourseGrade class connects a Professor and a Course with grades. It must have the following: Instance variables: Professor

help me with this class

instructions:

The CourseGrade class connects a Professor and a Course with grades. It must have the following: Instance variables: Professor professor, representing the CourseGrades professor Course course, representing the CourseGrades course Map grades, which maps a grade to the number of students who received that grade. The key is a String, rather than a char, because there are grades such as A+ and Other (explained below) that are more than one character. Constructors: 2 A constructor that takes a Professor and Course and sets each instance variable to the respective parameter. It should also initialize grades to a new, empty HashMap. Methods: Professor getProfessor() that returns the CourseGrades professor Course getCourse() that returns the CourseGrades course Map getGrades() that returns the CourseGrades grades void updateGrade(String grade, int numStudents) that sets grades for the key grade to numStudents. It should overwrite any previously stored grade. float getAverage() that returns the average GPA for CourseGrade. A grade can be converted to a GPA using this table (found here): A+ A A- B+ B B- C+ C C- D+ D D- F W Other 4.0 4.0 3.7 3.3 3.0 2.7 2.3 2.0 1.7 1.3 1.0 0.7 0.0 0.0 Ignore Note that this does not follow the way UMD calculates grades exactly. For example, this project counts a W as a 0, whereas UMD does not include Ws in GPA calculations. Other grades are grades which were not reported for some reason. They should be ignored. For example, a course with 3 students who received an A-, 1 who received a C, 1 who received a W, and 1 who received an Other will have an average GPA of 2.62: (3 ? 3.7) + (1 ? 2.0) + (1 ? 0.0) (3 + 1 + 1) = 2.62 We divide by 5, not 6, because we do not include the Other grade in the average calculation. Note that you do not need to round; just return what you calculated.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

class

public class CourseGrade implements Comparable {

private Professor professor;

private Course course;

private Map grades;

public CourseGrade (Professor professor, Course course) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public Professor getProfessor() {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public Course getCourse() {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public Map getGrades() {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public void updateGrade (String grade, int numStudents) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public float getAverage () {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public int getNumGrade (String grade) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public int getNumStudents() {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

@Override

public int compareTo(CourseGrade o) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

}

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!