Write a constructor for the class ScienceFairProjectRating, as described in Exercise 10 of the previous chapter. Give

Question:

Write a constructor for the class ScienceFairProjectRating, as described in Exercise 10 of the previous chapter. Give this constructor three parameters corresponding to the first three attributes that the exercise describes. The constructor should give default values to the other attributes.


Exercise 10

Consider a class ScienceFairProjectRating that will be used to help judge a science fair project. It will use the class RatingScore described in the previous exercise. The attributes for the new class are

  • The name of the project
  • A unique identification string for the project
  • The name of the person
  • A rating for the creative ability (max. 30)
  • A rating for the scientific thought (max. 30)
  • A rating for thoroughness (max. 15)
  • A rating for technical skills (max. 15)
  • A rating for clarity (max. 10)

It will have methods to

  • Get the number of judges
  • Get all the ratings for a particular project
  • Return the total of the ratings for a particular project
  • Return the maximum total rating possible
  • Return a string showing a project’s rating in a format suitable for display

a. Write a method heading for each method.

b. Write preconditions and postconditions for each method.

c. Write some Java statements that test the class.

d. Implement the class.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: