Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using java, write a class called Grades. Grades must have a main method (see example of what the main method does below). Grades are values

Using java, write a class called Grades. Grades must have a main method (see example of what the main method does below). Grades are values between zero and 10 (both zero and 10 included), and are always rounded to the nearest half point (i.e. ALL GRADES entered in the system end in either .0 or .5). To translate grades to letters: 8.5 to 10.0 become an "A," 7.5 and 8.0 become a "B," 6.5 and 7.0 become a "C," 5.5 and 6.0 become a "D," and 0.0 to 5.0 become an "F." Anything else is an error. Implement a program such that, it asks the user for a grade, and then it prints the corresponding letter. If the user enters a grade lower than zero or higher than 10, print an error message (as in example below). ALL GRADES MUST END IN EITHER .0 or .5, including 10.0 and 0.0. Examples: % java Grades enter a number grade: 11.0 ERROR: 11.0 % java Grades enter a number grade: 11 ERROR: 11 % java Grades enter a number grade: 10 ERROR: 10 % java Grades enter a number grade: 10.0 letter grade is A % java Grades enter a number grade: 9.8 ERROR: 9.8 % java Grades enter a number grade: 9.5 letter grade is A % java Grades enter a number grade: 9.0 letter grade is A % java Grades enter a number grade: 9 ERROR: 9 % java Grades enter a number grade: 8.5 letter grade is A % java Grades enter a number grade: 8.0 letter grade is B % java Grades enter a number grade: 7.5 letter grade is B % java Grades enter a number grade: 7.0 letter grade is C % java Grades enter a number grade: 6.0 letter grade is D % java Grades enter a number grade: 5.5 letter grade is D % java Grades enter a number grade: 5.0 letter grade is F % java Grades enter a number grade: 3.0 letter grade is F % java Grades enter a number grade: 0.0 letter grade is F % java Grades enter a number grade: 0 ERROR: 0 % java Grades enter a number grade: -1 ERROR: -1 % java Grades enter a number grade: 0.1 ERROR: 0.1 % java Grades enter a number grade: 9.51 ERROR: 9.51 % java Grades enter a number grade: 9.000001 ERROR: 9.000001 %

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

i need 2 7 7 .

Answered: 1 week ago

Question

A bond's duration is not a function of the bond's

Answered: 1 week ago