onsider 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.


a) ```
public void rateProject()
public int totalRating()
public int maxRating()
public String getRatingString()
```

b)
public void rateProject()
Precondition: none.
Postcondition: Ratings were obtained from the user for each category and then set.

public int totalRating()
Precondition: none.
Postcondition: The total of the ratings in each category was returned.

public int maxRating()
Precondition: none.
Postcondition: The maximum possible total rating over all categories was returned.

public String getRatingString()
Precondition: none.
Postcondition: A string in a nice format that shows the rating of the project.

c&d)
See the code in ScienceFairProjectRating.java.

Computer Science & Information Technology

You might also like to view...

The destructor for a class is called

a. explicitly from the main program b. when the class is instantiated c. when the object of the class goes out of scope d. Only at the end of main

Computer Science & Information Technology

Stacks are known as ________ data structures.

a. FIFO. b. FILO. c. LIFO. d. LILO.

Computer Science & Information Technology

You can use the ________ to create specialized reports that come preformatted to for name-brand labels such as Avery

A) Label Wizard B) Report Wizard C) Form Wizard D) Mailing Wizard

Computer Science & Information Technology

Which PC design element would be most critical if the number one client requirement was quietness

A) Memory requirements B) Cooling system C) Processor requirements D) Applications used E) Storage subsystem

Computer Science & Information Technology