Assignemnt #51
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: Alpha Program
/// File Name: Alpha.java
/// Date Finished: 9/9/2015
import java.util.Scanner;
public class Alpha
{
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.println("You don't have to wait long, \"" + name + "\".");
}
else if (name.compareTo("Jones") <0)
{
System.out.println("That's not a bad wait, \"" + name + "\".");
}
else if (name.compareTo("Smith") <0)
{
System.out.println("Looks like a bit of a wait, \"" + name + "\".");
}
else if (name.compareTo("Young") <0)
{
System.out.println("It's gonna be a while, \"" + name + "\".");
}
else if (name.compareTo("Young") >=0)
{
System.out.println("Not going anywhere for a while?");
}
}
}
Picture of the output