KeyChainRU

Code

import java.util.Scanner;

public class KeyChainRU
{
    public static void main ( String [] args )
    {
        Scanner keyboard = new Scanner(System.in);
        
        int ans, num = 0, num1 = 0, num2 = 0, sremove;
        do
        {
        System.out.println( "1.Add Keychain to order" );
        System.out.println( "2.Remove Keychain from order");
        System.out.println( "3.View Current Order");
        System.out.println( "4.Checkout");
        ans = keyboard.nextInt();
        
        if ( ans == 1 )
        {
            
            
            num = num+add(num1);
            
            System.out.println( " You currently have " + num + "  keychains " );
        }
            
        else if ( ans == 2 )
        {
            num = num-remove(num2);
            
            if ( 0 >num )
            {
                num=0;
                System.out.println( " Error, your order will be put back to zero " );
            }
            System.out.println( " You currently have " + num + " keychains " );
        }
            
        else if ( ans == 3 )
        {
            view(num);
        }
            
        else if ( ans == 4 )
        {
            checkout();
            System.out.println( " so you would like " + num + " keychains " );
            System.out.println( " For $" + ((((num*10)*1.0825)+5+(num))));
        }
        
            
        }while ( ans != 4 );
        
    }

    
    public static int add( int a1)
    {
        Scanner keyboard = new Scanner(System.in);
        int b1;
        System.out.println( " Adding Keychain, how many? " );
        System.out.println( " ");
        System.out.println( " ");
        b1 = keyboard.nextInt();
        return b1;
    }
    public static int remove( int a2)
    {
        Scanner keyboard = new Scanner(System.in);
        int b2;
        System.out.println( " Removing Keychain, how many? " );
        System.out.println( " ");
        System.out.println( " ");
        b2 = keyboard.nextInt();
        return b2;
    }
    public static int view( int a3 )
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println( "Your order is " + a3 + " keychains " );
        System.out.println( " It will cost you $" + ((((a3*10)*1.0825)+5+(a3))));
        return a3;
    }
        
    public static void checkout()
    {
        System.out.println( " Checkout " );
        System.out.println( " ");
        System.out.println( " ");
    }
}

KeyChainRU

Assignment 103