Assignemnt #47 Alabetical order
Code
///Name: JJ Deng
///Period: 6
///Program Name: Aplabetical Order
///File Name: AOrder.java
///Date Finished: 12/1/15
import java.util.Scanner;
public class AOrder
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String name;
System.out.print( "Last name please? " );
name = keyboard.next();
if (name.compareTo("Deng") <0)
{
System.out.println( "You don't have to wait long." );
}
else if (name.compareTo("Kasey") <0)
{
System.out.println( "That's not bad." );
}
else if (name.compareTo("Oscar") <0)
{
System.out.println( "Looks like you're gonna wait a little bit." );
}
else if (name.compareTo("Wilson") <0)
{
System.out.println( "Its gonna be a while." );
}
else
{
System.out.println( "Not going anywhere for a while?" );
}
}
}
Picture of the output