Assignment # 51 and Alphabetical Order
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: AlphabeticalOrder
/// File Name: AlphabeticalOrder.java
/// Date: 11/30/2015
import java.util.Scanner;
public class AlphabeticalOrder
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter your last name: ");
String LName = keyboard.next();
if (LName.compareTo("Carswell")<=0) System.out.println("You don't have to wait long.");
else if (LName.compareTo("Jones")<=0) System.out.println("That's not bad.");
else if (LName.compareTo("Smith")<=0) System.out.println("It looks like a bit of wait.");
else if (LName.compareTo("Young")<=0) System.out.println("It's going to take a while.");
else System.out.println("You're not going anywhere for a while.");
}
}
Picture of the output