Question: Create a Java program called MileageRatingYourLastName that prompts the user for a gas mileage with decimals. Return the result from the mileage rating scale based

Create a Java program called MileageRatingYourLastName that prompts the user for a gas mileage with decimals. Return the result from the mileage rating scale based on the table below.

Create a Java program called MileageRatingYourLastName that prompts the user for a

Add input validation to your program. The following inputs would be errors for our program:

  • Any negative numbers
  • Any input that is not a sequence of numbers

If your user enters any of these items, we want to provide and error and exit the program.

Create a method to return the rating. It should accept a mileage and return a String, which represents the values above.

You should create a testing file to test your method. It should have 4 assert methods minimally.

When you are finished with your program, upload the two .java file to this assignment. This assignment is worth 20 points.

Consumer Federation of America's Mileage Rating Scale Mileage Mileage Rating Scale Over 40 MPG Excellent 30-39 MPG Good 20-29 MPG Fair Under 20 MPG Poor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!