Prog 51: Alphabetical Order
///Name: Ilana Levy
///Period: 5
///Program Name: Alphabetical Order
///File Name: alphabetOrder.java
///Date Finished: 9/17/2015
import java.util.Scanner;
public class alphabetOrder
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner( System.in );
String name;
System.out.print( "What's your last name? " );
name = keyboard.next();
if ( name.compareTo( "Carswell" ) < 0 )
{
System.out.print( "You don't have to wait long" );
}
else if ( name.compareTo( "Carswell" ) >= 0 && name.compareTo( "Jones" ) < 0 )
{
System.out.print( "that's not bad" );
}
else if ( name.compareTo( "Jones" ) >= 0 && name.compareTo( "Smith" ) < 0 )
{
System.out.print( "looks like a bit of a wait" );
}
else if ( name.compareTo( "Smith" ) >=0 && name.compareTo( "Young" ) < 0 )
{
System.out.print( "it's gonna be a while " );
}
else if ( name.compareTo( "Young" ) >= 0 )
{
System.out.print( " not going anywhere for a while? " );
}
}
}