Assignment #103 and Keychains for Sale, real ultimate power

Code

    /// Name: Ali Kurland
    /// Period: 6
    /// Program Name: Keychains for Sale, real ultimate power
    /// File Name: UltimateKeychains.java
    /// Date Finished: 12/8/2015
    
    import java.util.Scanner;
    
    public class UltimateKeychains
    {
        public static void main ( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            
            int choice, numKeychains = 0, pricePerKeychain = 10, baseShipping = 5, perKeychainShipping = 1;
            double tax = .0825;
            
            System.out.println("Super Cool Keychain Shop");
            
            do
            {
            System.out.println("\n1. Add Keychains to Order");
            System.out.println("2. Remove Keychains from Order");
            System.out.println("3. View Current Order");
            System.out.println("4. Checkout");
            System.out.print("\nPlease enter your choice: ");
            choice = keyboard.nextInt();
            
            while ( choice > 4 || choice < 1 )
            {
                System.out.print( "Error: choose a number between one and four. Try again: " );
                choice = keyboard.nextInt();
            }
                
            if ( choice == 1 )
            {
                numKeychains = addKeychains(numKeychains);
            }
            else if ( choice == 2 )
            {
                numKeychains = removeKeychains(numKeychains);
            }
            else if (choice == 3)
            {
                viewOrder(numKeychains, pricePerKeychain, tax, baseShipping, perKeychainShipping);
            }
            else if ( choice == 4 )
            {
                checkout(numKeychains, pricePerKeychain, tax, baseShipping, perKeychainShipping );
            }
            }while ( choice != 4 );
        }
        
        public static int addKeychains( int numKeychains )
        {
            Scanner keyboard = new Scanner(System.in);
            
            System.out.print("\nYou have " + numKeychains + " keychains. How many to add? ");
            int add = keyboard.nextInt();
            
            while ( add < 0 )
            {
                System.out.print( "You must add a positive number of keychains. Try again: how many to add? ");
                add = keyboard.nextInt();
            }
            
            numKeychains = numKeychains + add;
            
            System.out.print("You now have " + numKeychains + " keychains.\n");
            return numKeychains;
        }
        
        public static int removeKeychains( int numKeychains )
        {
            Scanner keyboard = new Scanner(System.in);
            
            System.out.print("\nYou have " + numKeychains + " keychains. How many to remove? ");
            int remove = keyboard.nextInt();
            
            while ( remove > numKeychains )
            {
                System.out.println( "Error: Number of keychains to remove exceeds number of keychains in cart.");
                System.out.print( "Try again: how many to remove? " );
                remove = keyboard.nextInt();
            }
            
            numKeychains = numKeychains - remove;
            
            
            System.out.print("You now have " + numKeychains + " keychains.\n");
            return numKeychains;
        }
        
        public static void viewOrder( int numKeychains, int pricePerKeychain, double tax, int baseShipping, int perKeychainShipping )
        {
            System.out.println( "\nYou have " + numKeychains + " keychains. " );
            System.out.println( "Keychains cost $10 each.  The cost of " + numKeychains + " keychains is $" + ( numKeychains * pricePerKeychain ) + "." );
            System.out.println( "The shipping charges on this order are $" + ( baseShipping + (numKeychains * perKeychainShipping) ) + "." );
            int subtotal = (numKeychains * pricePerKeychain) + baseShipping + (numKeychains * perKeychainShipping);
            System.out.println( "The subtotal on this order is $" + subtotal + "." );
            System.out.println("The tax on this order is $" + ( tax * subtotal ) + "." );
            System.out.println( "The final cost of this order is $" + ( ( tax * subtotal ) + subtotal ) + "." );
        }
        
        public static void checkout( int numKeychains, int pricePerKeychain, double tax, int baseShipping, int perKeychainShipping )
        {
            Scanner keyboard = new Scanner(System.in);
            
            System.out.println("\nCHECKOUT\n");
            
            System.out.print( "What is your name? " );
            String name = keyboard.next();
            viewOrder(numKeychains, pricePerKeychain, tax, baseShipping, perKeychainShipping);
            System.out.println( "Thanks for your order, " + name + "!" );
        }
    }
    

Picture of the output

Assignment 103