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.
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 PoorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started