Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago