Question: i dont understand what to do The Rater class represents a rating system for a company. The company rated on a scale of 1-5. The


i dont understand what to doThe Rater class represents a rating system for a company. The company rated on a scale of 1-5. The toString representation changes based on how well rated the company is. Suppose we have a company called "Tina's Tires". . If its rating is less than two, toString would return "Not Recommended Company Tina's Tires" If its rating is over 3.5, toString would return "Gold Star Company Tina's Tires" Otherwise, toString would return "Well Rated Company Tina's Tires" . Remember, once a return statement is executed, the rest of the method is skipped. Therefore, if you return a String in an if statement, the remaining if statements will not be tested. The other method you need to fill in is setRating. The rating should only be changed if the new rating is 5 or less. After you fill in Rating, main should produce the following output. Note that main runs several test cases to check all of the conditions of the program! We need to make sure to test every line of code! Current Rating: 2.0 Well Rated Company Ir Cookery Current Rating: 4.5 Gold Star Company in Cookery Remember, once a return statement is executed, the rest of the me skipped. Therefore, if you return a String in an if statement, the re if statements will not be tested. The other method you need to fill in is setRating. The rating shoul be changed if the new rating is 5 or less. After you fill in Rating, main should produce the following output. that main runs several test cases to check all of the conditions of th program! We need to make sure to test every line of code! Current Rating: 2.0 Well Rated Company Jr Cookery Current Rating: 4.5 Gold Star Company Jr Cookery Current Rating: 4.5 Gold Star Company Jr Cookery Current Rating: 1.0 Not Recommended Company Jr Cookery I 1 public class Rater 2-1 3 private String name; // name of company 4 private double rating; // number rating (1 - 5) 5 6 7 public Rater(String company, double initialRating) 8- { 9 name = company; 10 rating - initialRating; 11 3 12 13 // Set rating to newRating 14 // As long as it's no more than 5 15 public void setRating(double newRating) 16 - { 17 18 } 19 20 // Returns the rating of the company 21 public double getRating 22 - { 23 return rating; 24 3 25 26 // Returns a string representation of the company 27 // based on their ratings 28 public String tostring() 29- { 30 1/ remember, once a return statement is 31 1/ executed, the program LEAVES the method. 32 1/ Nothing after the executed return statement is executed. 33 34 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
