PROGRAMMING AND CODE


Assignemnt #101

Code

/// Name: Justin Li
/// Period: 7
/// Program Name: Keychains
/// File Name: Keychains.java
/// Date Completed: 3/22/16

import java.util.Scanner;
    
    public class Keychains {
    
        public static void main(String[] args) {
        
            Scanner k = new Scanner(System.in);
            
            int n = 0;
            
            System.out.println("Keychains for sale.\n");
            
            do {
                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. Checkout\n");
                System.out.print("Please enter your choice: ");
                n = k.nextInt();
                
                if (n == 1)
                    Add();
                else if (n == 2)
                    Remove();
                else if (n == 3)
                    View();
                else if (n == 4)
                    Checkout();
                else
                    System.out.println("Error: Try again");
            } while (n != 4);
        }
        
        public static void Add() {
            System.out.println("\nSorry, you can't add any keychains.\n");
            
            return;
        }
        
        public static void Remove() {
            System.out.println("\nSorry, you can't remove any keychains.\n");
            
            return;
        }
        
        public static void View() {
            System.out.println("\nSorry, you can't view your current order.\n");
            
            return;
        }
        
        public static void Checkout() {
            System.out.println("\nYou have nothing to see in checkout. Bye.\n");
            
            return;
        }
    }
    

Picture of the output

Assignment 1