Question: What coding what I put to fix my errors? 5 points Status: Not Submitted The Rater class represents a rating system for a company. The







5 points Status: Not Submitted The Rater class represents a rating system for a company. The company is 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. 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! After you RUN CODE TEST CASES 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 or Cookery Current Rating: 4.5 Gold Star Company or cookery Current Rating: 4.5 Gold Star Company Jr Cookery Current Rating: 1.0 Not Recommended Company in Cookery Save Submit Continue iii FILES Raterjavo Roter Testerjavo WN 1 public class RaterTester 2-1 3 public static void main(String] args) { 5 Rater jrs = new Rater("Jr Cookery", 2); 6 7 System.out.println("Current Rating:" + 8 jrs.getRating); 9 10 System.out.println(jrs.toString(); 11 jrs.setRating(4.5); 12 13 System.out.println("Current Rating:" + 14 frs.getRating(); 15 16 System.out.println(irs.toString(); 17 jrs.setRating (100); 18 19 System.out.println("Current Rating:" + 20 jrs.getRating()); 21 22 System.out.println(ns.toString()); 29 frs.setRating (1) 24 System.out.println("current Ratings 26 ins.getRating): 27 28 System.out.println(ins.tostring) 29 25 3.2.9: Rating Save Submit Continue !!! jrs.getRating()); 26 27 28 29 30 31 System.out.println(jrs.toString(): FILES Raterjave 32 // Test Case: In the middle System.out.println("Current Rating: System.out.println(rs); + jrs.getRating(); D Ratertesterjava jrs.getRating()); 33 34 35 36 37 38 30 40 41 42 43 44 45 46 47 48 49 5e 51 52 53 54 1/ Test Case: High rating jrs.setRating(4.5): System.out.println(" Current Rating: System.out.println(s); W Test Case: Setting rating too high ins.setRating(100) System.out.println(" Current Ratings System.out.println(s); frs.getRating()); 7 Test Case low rating ns.setRating (1) System.out.println("Incurrent Rating: System.out.println(s); ns.getRating(7) Save Submit Continue 1 public class Rater 2. { FILES private String name; // name of company private double rating: // number rating (1 - 5) 4 5 6 7 8- 9 Raterjava Rater Tester.java public Rater(String company, double initialRating) { this.company - company; this.rating - initialRating: ) String company; // Set rating to newRating // As long as it's no more than 5 public void setRating(double newRating) 11 12 13 14 15 16 17- 18 19 2e 21 22 23 24 - 25 26 27 28 29 if(rating // Returns the rating of the company public double getRating() return rating: 1 W Returns a string representation of the company 1/ based on their ratings Raung Save Save Submit . Continue ili public void setRating(double newRating) { if(rating 3.5) return "Gold Star Company Tina's Tires ", Jelse return "Well Rated Company "Tina's TiresIn"; 37 38 39 4 41 42 43 44 RUN CODE TEST CASES ASSIGNMENT DOCS GRADE MORE Great! Testing rating set correctly in constructor Testing setRating You shouldn't modify the constructor 1.0 Expected result: Your result: 3.0 Difference: 13.0 Testing setRating You shouldn't modify the constructor 1. Expected result 5.0 Your result: 15.0 Difference: RUN CODE TEST CASES ASSIGNMENT DOCS GRADE MORE Testing toString with rating 1 Check the instructions for toString Expected result: Not Recommended Company Fish Company Your result: Not Recommended Company Tina's Tires Difference: Not Recommended Company FTina'sh Company Tires Testing toString with rating 2.5 Check the instructions for toString Expected result Well Rated Company Bread Company Your result Well Rated Company Tina's Tires Difference: Well Rated Company BTina's Tiread Companys Testing toString with Check the Instructions for
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
