import java.util.Scanner;
/*
PROGRAM: TestScores.java
Written by Julio C. Villa
Write a program that has variables to hold 3 test scores. The program should ask the user to enter
three test scores and then assign the values entered to the variables. The program should display
the average of the test scores and the letter grade that is assigned for the test score average.
Use the grading scheme in the following table:
*/
public class TestScores
{
public static void main(String[ ] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter the first score");
String score1;
score1 = keyboard.nextLine();
System.out.print("Enter the second score");
String score2;
score2 = keyboard.nextLine();
System.out.print("Enter the third score");
String score3;
score3 = keyboard.nextLine();
String answer;
answer = (score1 + score2 + score3 / 3);
if (answer >= 90)
System.out.println("The average score is + answer + . You earned an A.");
else if (answer >= 80 && answer <= 89)
System.out.println("The average score is + answer + . You earned a B.");
else if (answer >= 70 && answer <= 79)
System.out.println("The average score is + answer + . You scored a C.");
else if (answer >= 60 && answer <= 69)
System.out.println("The average score is + answer + . You scored a D.");
else
System.out.println("The average score is + answer + . You scored an F.");
}
}
Thank you for your help!
Mod edit - Please

New Topic/Question
Reply




MultiQuote




|