Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Alphabetical Order
/// File Name: Order.java
/// Date Finished: 11/24/2015 public class Order
import java.util.Scanner;
public class Order
{
public static void main( String[] args )
{
String lastName;
int a, b, c, d;
Scanner keyboard = new Scanner(System.in);
System.out.print( "What's your last name? " );
lastName = keyboard.next();
a = lastName.compareTo("Carswell");
if ( a <= 0 )
{
System.out.println( "You don't have to wait long " + lastName + "." );
}
else if ( a > 0 )
{
b = lastName.compareTo("Jones");
if ( b <= 0 )
{
System.out.println( "That's not bad " + lastName + "." );
}
else if ( b > 0 )
{
c = lastName.compareTo("Smith");
if ( c <= 0 )
{
System.out.println( "Looks like a bit of a wait " + lastName + "." );
}
else if ( c > 0 )
{
d = lastName.compareTo("Young");
if ( d <= 0 )
{
System.out.println( "It's going to be a while " + lastName + "." );
}
else if ( d > 0 )
{
System.out.println( "Notgoing anywhere for a while " + lastName + "." );
}
}}}
}
}
Picture of the output