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
-- 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
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...
Create a Grade application that prompts the user for the percentage earned on a test or...
Create a Grade application that prompts the user for the percentage earned on a test or other graded work and then displays the corresponding letter grade. The application should use the grading scale at your school or the following grading scale: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D below 60 F The application output should look similar to: Enter your marks: 90 Grade: A Notes: coded in java. Please don't make...
write a program that automates the process of generating the final student report for DC faculty...
write a program that automates the process of generating the final student report for DC faculty considering the following restrictions. Consider declaring three arrays for processing the student data: studID studName studGrade The student ID is a random number generated by the 5-digit system in the range of (10000 - 99999). Create a function to assign the student ID generated in an array of numbers. Consider the following to generate the random number: Add the libraries: #include <stdlib.h> #include <ctime>...
Write a program in Java that: 1. will prompt user with a menu that contains options...
Write a program in Java that: 1. will prompt user with a menu that contains options to: a. Add a To-Do Item to a todo list. A To-Do Item contains: i. An arbitrary reference number (4; 44,004; etc.) ii. A text description of the item ("Pick up dry cleaning", etc.) iii. A priority level (1, 2, 3, 4, or 5) b. View an item in the list (based on its reference number) c. Delete an item from the list (based...
Create a Java Program to calculate luggage costs. The Business Rules are: A. Two bags per...
Create a Java Program to calculate luggage costs. The Business Rules are: A. Two bags per person are free. B. The Excess Bag Charge is $75 per bag. The program needs to do the following: 1. In your main method(),    Create integers to store the number of Passengers and also the total number of bags    Prompt for the number of passengers on a ticket.    Prompt for the total number of bags for all passengers on a ticket....
Solve the following using java Write a program that runs three threads, each thread randomizes a...
Solve the following using java Write a program that runs three threads, each thread randomizes a number between 1 and 100. The main thread waits for all the others to finish, calculates the maximum of the numbers, which were randomized, and prints it. Random number 1: 10 Random number 2: 38 Random number 3: 81 Max: 81 Note: You should create 3 threads in adition to the main thread. Also, you can use a single thread class and create 3...
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
JAVA Exercise_Pick a Card Write a program that simulates the action of picking of a card...
JAVA Exercise_Pick a Card Write a program that simulates the action of picking of a card from a deck of 52 cards. Your program will display the rank and suit of the card, such as “King of Diamonds” or “Ten of Clubs”. You will need: • To generate a random number between 0 and 51 • To define two String variables: a. The first String should be defined for the card Suit (“Spades”, “Hearts”, “Diamonds”, “Clubs”) b. The second String...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT