Assignemnt #51 and Alphabetical Order
Code
///Name: Ben Borglin
///Period: 6
///Program Name: Alphabetical Order
///File Name: aOrder.java
///Date Finished: 10/7/15
import java.util.Scanner;
public class aOrder
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String last;
System.out.print("What is your last name?");
last = keyboard.next();
if (last.compareTo("Carswell") < 0)
{
System.out.println("You dont have to wait long " + last);
}
else if(last.compareTo("Jones") < 0)
{
System.out.println("That's not bad of a wait " + last);
}
else if(last.compareTo("Smith") < 0)
{
System.out.println("Looks like you have a bit of a wait " + last);
}
else if(last.compareTo("Young") < 0)
{
System.out.println("It is going to be a long wait " + last);
}
else
{
System.out.println("Not going anywhere for awhile?");
}
}
}
Picture of the output