Assignment #51

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: AlphabeticalOrder
    ///File Name: AlphabeticalOrder.java
    ///Date: 11/9/15
    
    import java.util.Scanner;
    
    public class AlphabeticalOrder
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            String name;
            int i;
            
            System.out.print(" What is your last name? " );
            name = keyboard.next();
            
            
            if ( name.compareTo("Carswell") <= 0 )
                System.out.println( "You don't have to wait long" );
            
            else if ( name.compareTo("Carswell") > 0 && name.compareTo( "Jones" ) <= 0 )
                System.out.println( "that's not bad" );
            
            else if ( name.compareTo("Jones") > 0 && name.compareTo("Smith") <= 0 )
                System.out.println("Looks like a bit of a wait" );
            
            else if ( name.compareTo("Smith") > 0 && name.compareTo("Young") <= 0 )
                System.out.println("it's gonna be a while");
                
            else if ( name.compareTo("Young") > 0 )
                System.out.println("Not going anywhere for a while? ");
                
        }
    }


        
    

Picture of the output

Assignment 51