Assignemnt #51 Alphabetical Order
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Alphabetical Order
///File Name: AO.java
///Date: 11/9/2015
import java.util.Scanner;
public class AO
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
int i;
String name;
System.out.println("What is your last name?");
name = keyboard.next();
i = name.compareTo("Carswell");
if(i<=0)
System.out.println("You don't have to wait long.");
else if(i<=7)
System.out.println("That's not bad.");
else if(i<=16)
System.out.println("Looks like a bit of a wait.");
else if(i<=22)
System.out.println("Not going anywhere for a while?");
}
}
Picture of the output