Assignment #51
Code
///jack newsom
///period 5
///program AlphaOrder
///filename AlphaOrder.java
///date completed 9/29/15
import java.util.Scanner;
public class AlphaOrder
{
public static void main( String[] args)
{
Scanner alphabot = new Scanner(System.in);
String lName;
System.out.println("What's your last name?");
lName = alphabot.next();
int a = lName.compareTo("Young");
if ( a <= 0 )
{
if ( a < 0 )
{
int b = lName.compareTo("Smith");
if ( b < 0 )
{
int c = lName.compareTo("Jones");
if ( c < 0 )
{
int d = lName.compareTo("Carswell");
if ( d <= 0)
{
System.out.println("You don't have to wait long, " + lName + ".");
}
else
{
System.out.println("That's not bad, " + lName + ".");
}
}
else if ( c == 0 )
{
System.out.println("That's not bad, " + lName + ".");
}
else
{
System.out.println("Looks like a bit of a wait, " + lName + ".");
}
}
else if (b == 0)
{
System.out.println("Looks like a bit of a wait, " + lName + ".");
}
else
{
System.out.println("It's gonna be a while, " + lName + ".");
}
}
else
{
System.out.println("It's gonna be a while, " + lName + ".");
}
}
else
{
System.out.println("You're not going anywhere for a while, " + lName + ".");
}
}
}
Picture of the output