Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE IDE
A = 90-100
B = 80-89
C = 70-79
D = 60-69
F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display the letter grade associated with the numeric grade. This can all be done inside the main() method.
Code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scnr=new Scanner(System.in);
short grade;
System.out.print("Pleaes Enter a grade (0 - 100): ");
grade=scnr.nextShort();
System.out.println();
if(grade>=90)
System.out.println("Letter Grade: A");
else if(grade>=80)
System.out.println("Letter Grade: B");
else if(grade>=70)
System.out.println("Letter Grade: C");
else if(grade>=60)
System.out.println("Letter Grade: D");
else
System.out.println("Letter Grade: F");
}
}
Outputs
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
Get Answers For Free
Most questions answered within 1 hours.