Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Write a class called Grades. Grades are values between zero and 10 (both zero and 10 included), and are always rounded to the nearest

Java

Write a class called Grades.

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:

(program must give the messages below)

% java Grades

enter a number grade: 8

Error: 8

% java Grades

enter a number grade: 8.0

letter grade is B

% java Grades

enter a number grade: 13.0

Error: 13.0

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 Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions