Assignment #51 and Alphabetical Order

Code


/// Name: Tim Chuang
/// Period: 7
/// Program Name: Alphabetical Order
/// File Name: AlphabeticalOrder.java
/// Date Finished: 12/1/2015

import java.util.Scanner;

class AlphabeticalOrder 
{
      public static void main(String[] args) 
      {
                 
        Scanner keyboard = new Scanner(System.in);
           
        String lastName;
        int a, b, c, d;
        System.out.print( "What's your last name? " );
        lastName = keyboard.next();
        a = lastName.compareTo("Chuang");
        if ( a <= 0 )
        {
            System.out.println( "You don't have to wait long " + lastName + "." );
        }
        else if ( a > 0 )
        {
            b = lastName.compareTo("Wao");
        if ( b <= 0 )
        {
            System.out.println( "That's not bad " + lastName + "." );
        }
        else if ( b > 0 )
        {
            c = lastName.compareTo("Yuzuriha");
        if ( c <= 0 )
        {
            System.out.println( "Looks like a bit of a wait " + lastName + "." );
        }
        else if ( c > 0 )
        {
            d = lastName.compareTo("Ayanami");
        if ( d <= 0 )
        {
            System.out.println( "It's going to be a while " + lastName + "." );
        }
        else if ( d > 0 )
        {
            System.out.println( "Notgoing anywhere for a while " + lastName + "." );
        }
        }}}
    }
}
   

Picture of the output

Assignment 51