Assignment #51 Alphabetic Order
Code
///Name: Ian Grant
///Period:5
///Project Name: Alphabetic Order
///File Name:AlphaOrder.java
///11/3/15
import java.util.Scanner;
public class AlphaOrder
{
public static void main(String [] args)
{
Scanner stuff=new Scanner(System.in);
String name;
int a1,a2,a3,a4;
System.out.print("Hey you, what your last name? ");
name=stuff.next();
a1=name.compareTo("Carswell");
a2=name.compareTo("Jones");
a3=name.compareTo("Smith");
a4=name.compareTo("Young");
if (a1<=0)
System.out.println("You don't have to wait long.");
else if (a2<=0)
System.out.println("That's not bad.");
else if (a3<=0)
System.out.println("Looks like a bit of a wait");
else if (a4<=0)
System.out.println("It;s gonna be a while.");
else
System.out.println("Not going anywhere for a while?");
}
}
Output