Question

Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE...

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.

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a Java program to display a letter grade based on an actual grade. A =...
Write a Java program to display a letter grade based on an actual grade. 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...
-- 3. Create a variable to store a numeric grade -- Write a CASE statement that...
-- 3. Create a variable to store a numeric grade -- Write a CASE statement that uses the variable to calculate a letter grade -- If the numeric grade is above 100 or below 0, return "Invalid grade" -- A = 90-100, B = 80-89, C = 70-79, D = 60-69, F = 0-59 -- Hint: SELECT doesn't always require a FROM clause
In Python... Write a program that calculates a student’s final grade in this course. The program...
In Python... Write a program that calculates a student’s final grade in this course. The program should: Display a message stating its goal Prompt the user to enter a student’s average grade for the weekly assignments, grade for mid-course project and grade for final project Calculate the final grade based on these percentages... Assignments = 60% Mid-course & Final Project = 40% (20% each) A A- B+ B B- C+ C C- D+ D D- E 100-94 93-89 88-85 84-82...
5) Create a Java program using Scanner: Write a program where you will enter the grade...
5) Create a Java program using Scanner: Write a program where you will enter the grade score for 5 classes, then it will display total points and average and it will display the grade based on percentage. Steps: 1) Declare variable integer for English, Chemistry, Java Programming, Physics and Math 2) Declare variable total and percentage 3) Create Scanner object and prompt the user to enter grades for each class and input grades after each class 4) Calculate total of...
Write a program that keeps reading a test score until a -1 is entered. The program...
Write a program that keeps reading a test score until a -1 is entered. The program will output the letter grade according to the table below: Score Grade 90-100.   A 80-89.   B 70-79.   C 60-69.   D < 60.   F For example: Enter a Score (-1 to Exit): 92 The Letter grade for that score is A. Enter a Score (-1 to Exit): -1
C++ Write a program which accepts a numeric test score from the user. It will output...
C++ Write a program which accepts a numeric test score from the user. It will output the letter grade to the user corresponding to the score. Assume no “minus grades” (an A ranges from 90-100, B ranges from 80-89, C ranges from 70-79, D ranges from 60-69 and F is everything else.) Ensure that the score remains in the range of 0 to 100. As an example of the output: Enter your numeric grade and I will tell you your...
Java: A teacher has five students who have taken four tests. The teacher uses the following...
Java: A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores: Test Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D 0–59 F Write a class that uses a String array (or an ArrayList object) to hold the five students’ names, an array of five characters to hold the five students’ letter...
You are to write a program that will process students and their grades. For each student...
You are to write a program that will process students and their grades. For each student the program will read in a student’s name. It should also read in 10 test scores for the student and calculate his or her average. You must read the scores using a loop. The program should output the student’s name, average and letter grade. The average should be displayed accurate to 1 decimal digit. Letter grades are assigned based on the scale: 90-100    A...
4) Write a Java program using Conditions: Write a program where it will ask user to...
4) Write a Java program using Conditions: Write a program where it will ask user to enter a number and after that it will give you answer how many digits that number has. Steps: 1) Create Scanner object and prompt user to enter the number and declare variable integer for input 2) Use if else condition with && condition where you will specify the digits of numbers by writing yourself the digit number that should display: Example(num<100 && num>=1), and...
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1....
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January - December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs to adjust the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT