KeyChain

Code

import java.util.Scanner;

public class KeyChain
{
    public static void main ( String [] args )
    {
        Scanner keyboard = new Scanner(System.in);
        
        int ans ;
        
        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 )
        {
            add();
        }
        else if ( ans == 2 )
        {
            remove();
        }
        else if ( ans == 3 )
        {
            view();
        }
        else if ( ans == 4 )
        {
            checkout();
        }
        
        
        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 )
        {
            add();
        }
        else if ( ans == 2 )
        {
            remove();
        }
        else if ( ans == 3 )
        {
            view();
        }
        else if ( ans == 4 )
        {
            checkout();
        }
        }while ( ans != 4 );
        
    }

    
    public static void add()
    {
        System.out.println( " Adding Keychain " );
        System.out.println( " ");
        System.out.println( " ");
    }
    public static void checkout()
    {
        System.out.println( " Checkout " );
        System.out.println( " ");
        System.out.println( " ");
    }
    public static void remove()
    {
        System.out.println( " Removing KeyChain");
        System.out.println(" " );
        System.out.println(" " );
    }
    public static void view()
    {
        System.out.println( "Viewing order" );
        System.out.println( " ");
        System.out.println( " " );
    }
}
    

ModulusAnimation

Assignment 40