Assignment #51 and Alphabetical Order
Code
///Name: Trent Lane
///Period: 6
///Project Name: Alphabetical Order
///Date: 11/18/2015
import java.util.Scanner;
public class AlphabetOrder
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter your last name: ");
String lastName = keyboard.next();
if (lastName.compareTo("Carswell")<=0)
System.out.println("You don't have to wait long.");
else if (lastName.compareTo("Jones")<=0)
System.out.println("That's not bad.");
else if (lastName.compareTo("Smith")<=0)
System.out.println("It looks like a bit of wait.");
else if (lastName.compareTo("Young")<=0)
System.out.println("It's going to take a while.");
else
System.out.println("You aren't going anywhere for a while.");
}
}
Picture of the output