Question
please help I have been trying to get this for some time now and would love some help on this. Create a Java program that
please help I have been trying to get this for some time now and would love some help on this.
Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be handled together by a compound conditional statement that is joined by a short circuit AND or OR operator. Assign your error message to a String variable and use that variable in a System.out.println statement to print the error. You must assign a char variable for each letter grade. Use System.out.printf to print the letter grade.
Run your program several times using these inputs and ensure that you are receiving these outputs:
- input: 140
- expected output: ERROR - You have entered an invalid input.
- Input: -45
- expected output: ERROR - You have entered an invalid input.
- input: 82
- expected output: You have earned the letter grade B
Step 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