Assignemnt #97 Keychain Store

Code

    /// Name: JJ Deng
    /// Period: 6
    /// Program Name: Chains
    /// File Name: Chains.java
    /// Date Finished: 3/25/2016
    
import java.util.Scanner;
import java.util.InputMismatchException;

public class Chains{
    public static void main(String[] args){
        System.out.println(" Good old JJ KeyChain Shop");

        
        int choice = 0;
        
        do{
            showMenu();
            
            do choice = choice();
            while (choice ==0);
            
            if (choice == 1) addKey();
            if ( choice == 2) removeKey();
            if (choice == 3) viewOrder();
            
            System.out.println();
        }
        while (choice!=4);
        
        checkOut();
        
        System.out.println();
    }
    
    public static void showMenu(){
        System.out.println("1) Add Keychains to Order");
        System.out.println("2) Remove Keychains from Order");
        System.out.println("3) View Current Order");
        System.out.println("4) Check Out");
        System.out.println();
        
    }
    
    public static int choice() {
        Scanner keyboard = new Scanner(System.in);
        int choice = 0;
        System.out.print("Please Enter Your Choice: ");
        choice = keyboard.nextInt();
        
        if (choice < 1 || choice > 4) choice = 0;
        
        return choice;
    }
    
    public static void addKey(){
        System.out.println("ADD KEYCHAINS");
    }
    
    public static void removeKey(){
        System.out.println("REMOVE KEYCHAINS");
    }
    public static void viewOrder(){
        System.out.println("VIEW ORDER");
    }
    public static void checkOut(){
        System.out.println("CHECKOUT");
    }

    

Picture of the output

Assignment 101