/********************************************************************* * Author: Eric Heim * Date Created: 5/31/2011 * Course: CS0007 * Description: Shows the basic functionality of the if-else if * statement by taking in a number grade and displaying * the corresponding letter grade. *********************************************************************/ import java.util.Scanner; public class IfElseIfStatement { public static void main(String[] args) { int testScore; Scanner keyboard = new Scanner(System.in); System.out.print("Enter your numeric test score: "); testScore = keyboard.nextInt(); if (testScore < 60) { System.out.println("Your grade is an F."); } else if (testScore < 70) { System.out.println("Your grade is a D."); } else if (testScore < 80) { System.out.println("Your grade is a C."); } else if (testScore < 90) { System.out.println("Your grade is a B."); } else if (testScore < 101) { System.out.println("Your grade is an A."); } else { System.out.println("Invalid Grade"); } } }