Assignemnt #102 and Keychains for sale 2 Code /// Name: Yordan Rashkov /// Period: 7 /// Program Name: Keychains for sale 2 /// File Name: KFS2.java /// Date Finished: 3/29/2016 import java.util.Scanner; public class KFS2 { public static void main(String[] args) { Scanner k = new Scanner(System.in); int pricePerKey = 10; int opt; int numOfKeys = 0; System.out.println("Ye Olde Keychain Shoppe"); do { System.out.println(); 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"); System.out.println(); System.out.print("Please enter your choice: "); opt = k.nextInt(); System.out.println(); if (opt == 1) { numOfKeys = addKeychains( numberOfKeys ); System.out.println("You now have " + numOfKeys + " keychains."); } else if (opt == 2) { numOfKeys = removeKeychains( numberOfKeys ); System.out.println("You now have " + numOfKeys + " keychains."); } else if (opt == 3) viewOrder( numOfKeys, pricePerKey ); else if (opt == 4) checkout( numOfKeys, pricePerKey ); } while (opt != 4); } public static int addKeychains(int numOfKeys) { Scanner k = new Scanner(System.in); int keyNumberNow; System.out.print("You have " + numOfKeys + " keychains. How many to add? "); int add = k.nextInt(); keyNumberNow = numOfKeys + add; return keyNumberNow; } public static int removeKeychains(int numOfKeys) { Scanner k = new Scanner(System.in); int keyNumberNow; System.out.print("You have " + numOfKeys + " keychains. How many to remove? "); int remove = k.nextInt(); keyNumberNow = numOfKeys - remove; return keyNumberNow; } public static void viewOrder( int numOfKeys, int pricePerKey ) { int totalCost; System.out.println("You have " + numOfKeys + " keychains."); System.out.println("Keychains cost $" + pricePerKey + " each."); totalCost = numOfKeys * pricePerKey; System.out.println("Total cost is $" + totalCost + "."); } public static void checkout( int numOfKeys, int pricePerKey ) { Scanner k = new Scanner(System.in); int totalCost; System.out.println("CHECKOUT"); System.out.println(); System.out.print("What is your name? "); String name = k.next(); System.out.println("You have " + numOfKeys + " keychains."); System.out.println("Keychains cost $" + pricePerKey + " each."); totalCost = numOfKeys * pricePerKey; System.out.println("Total cost is $" + totalCost + "."); System.out.println("Thanks for your order, " + name + "!"); } }