Assignemnt #51 and AlphabeticalOrder
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Fortieth Program
/// file name: AlphabeticalOrder.java
/// date finished: 11/12/15
import java.util.Scanner;
public class AlphabeticalOrder
{
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 don't have to wait long." );
}
else if (last.compareTo("Jones") <0)
{
System.out.println( "That's not bad." );
}
else if (last.compareTo("Smith") <0)
{
System.out.println( "Looks like you're gonna wait a little bit." );
}
else if (last.compareTo("Young") <0)
{
System.out.println( "Its gonna be a while." );
}
else
{
System.out.println( "Not going anywhere for a while?" );
}
}
}
Picture of the output