h property. b. Your class should have two constructors: one that takes all properties, and one that takes only first name, last name, university name, and subject and sets both of the ratings to an appropriate default value. c. You should provide accessors (getters) and mutators (setters) for first name, last name, university name, and subject. d. Your class should provide a method to add a new rating for the professor. It should take two arguments: one for overall rating and one for level of difficulty, with values from 1 (awful) to 5 (aweso
You are designing an application to rate your professors.
a. Professors have the following properties: first name, last name, university
name, subject, and ratings for overall quality (1.0-5.0) and level of difficulty
(1.0-5.0). Your class should have instance variables of the appropriate
type for each property.
b. Your class should have two constructors: one that takes all properties, and
one that takes only first name, last name, university name, and subject
and sets both of the ratings to an appropriate default value.
c. You should provide accessors (getters) and mutators (setters) for first
name, last name, university name, and subject.
d. Your class should provide a method to add a new rating for the professor.
It should take two arguments: one for overall rating and one for level of
difficulty, with values from 1 (awful) to 5 (awesome). Each time a new
rating is provided, your class should calculate the average rating for the
professor and update the appropriate variable for each.
e. Your class should provide two methods to retrieve the averages for overall
rating and level of difficulty.
f. Your class should have an informative toString method.
g. Update your main method to create at least two professors and apply
several ratings to each. You should print the initial state of each professor
using your toString method as well as the change in state each time any
of the state is changed (e.g. a mutator is used to modify the subject or a
new rating is applied).
the solution is an given below :
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images