Assignment #51 Alphabetical Order

Code

    /// Name: Matthew Lorence
    /// Period: 5
    /// Program Name: Alphabetical Order
    /// File Name: AlphabeticalOrder.java
    
    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's your last name? ");
            last = keyboard.next();
            
            if (last.compareTo("Carswell") <=0)
            {
                System.out.println("You don't have to wait long, \"" + last + "\"." );
            }
            else if (last.compareTo("Carswell") >0 && last.compareTo("Jones") <=0)
            {
                System.out.println("That's not bad, \"" + last + "\"." );
            }
            else if (last.compareTo("Jones") >0 && last.compareTo("Smith") <=0)
            {
                System.out.println("Looks like a bit of a wait, \"" + last + "\"." );
            }
            else if (last.compareTo("Smith") >0 && last.compareTo("Young") <=0)
            {
                System.out.println("It's gonna be a while, \"" + last + "\"." );
            }
            else if (last.compareTo("Young") >0)
            {
                System.out.println("Not going anywhere for a while, \"" + last + "\"?" );
            }
            
        }
    }
        
        
    

Picture of the output

Assignment 51