Assignment #51 and AlphabeticalOrder
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: AlphabeticalOrder
/// File Name: AlphabeticalOrder.java
/// Date Finished:10/21/15
import java.util.Scanner;
public class AlphabeticalOrder
{
public static void main (String [] args)
{
String name;
Scanner keyboard = new Scanner(System.in);
System.out.print("What's your last name? ");
name = keyboard.next();
System.out.println();
if ( name.compareTo("Carswell") < 0)
{
System.out.println( "You don't have to wait long, \"" + name + ".\"");
}
else if ( name.compareTo("Jones") < 0)
{
System.out.println( "That's not bad, \"" + name + ".\"");
}
else if ( name.compareTo("Smith") < 0)
{
System.out.println( "Looks like a bit of a wait, \"" + name + ".\"");
}
else if ( name.compareTo("Young") < 0)
{
System.out.println("It's gonna be a while, \"" + name + ".\"");
}
else
{
System.out.println("Not going anywhere for a while, \"" + name + "?\"");
}
}
}
Picture of the output