/********************************************************************* * 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 NestedIfStatements { public static void main(String[] args) { double salary, yearsOnJob; Scanner keyboard = new Scanner(System.in); System.out.print("Enter your annual salary: "); salary = keyboard.nextDouble(); System.out.print("Enter the number of years at your current job: "); yearsOnJob = keyboard.nextDouble(); if (salary >= 30000) { if (yearsOnJob >= 2) { System.out.println("You qualify for a loan."); } else { System.out.println("You must have been at your current job " + "for at least 2 years to qualify."); } } else { System.out.println("You must earn at least $30,000 per year " + "to qualify."); } } }