I'm new to programming and i'm way out in left field on this one... I'm trying to write a program that takes takes numerical grade inputs and tells you what the letter grade is. The program must keep running until the user hits 'E' or 'e'.
Here's my problem: with what I have written, the Java isnt finding any errors, how ever when I run the program, it either locks up or prints out all the letter grades regardless of my values. ANY help would be greatly appreciated!
Code listed here:
import java.util.Scanner;
public class Grade {
public static void main(String[] args) {
String userInput;
int grade;
boolean moreOrder = true;
//Prompts the user to input numeric grade
System.out.println("Enter your numeric grade (0 to 100) or press 'E' to exit.");
while (moreOrder) {
}
// creates the scanner class to take inputs from keyboard
Scanner keyboard = new Scanner(System.in);
userInput = keyboard.nextLine();
grade = userInput.charAt(0);
char letter;
// Shows the program grabs the appropriate letter grade
if (grade >=90)
{
letter ='A';
System.out.println("Your letter grade is " + letter + ".");
}
else if (grade >=80)
{
letter ='B';
System.out.println("Your letter grade is " + letter + ".");
}
else if (grade >=70);
{
letter ='C';
System.out.println("Your letter grade is " + letter + ".");
}
if (grade >=60);
{
letter ='D';
System.out.println("Your letter grade is " + letter + ".");
}
if (grade <=59);
{
letter ='F';
System.out.println("Your letter grade is " + letter + ".");
}
if (grade == 'E' || grade == 'e')
{
System.out.println("The program has ended. See you next time.");
moreOrder = false;
}
else
System.out.println("Invalid choice, try again.");
}
}