Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions