Assignemnt #101 Chainz.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: Chainz
/// File Name: Chainz.java
/// Date Finished: 3/28/2016
import java.util.Scanner;
import java.util.InputMismatchException;
public class Chainz{
public static void main(String[] args){
System.out.println("WELCOME");
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 Keycahins from Order");
System.out.println("3) View Current Order");
System.out.println("4) Check Out");
}
public static int choice() {
Scanner keyboard = new Scanner(System.in);
int choice = 0;
System.out.print("Choice: ");
choice = keyboard.nextInt();
if (choice < 1 || choice > 4) choice = 0;
return choice;
}
public static void addKey(){
System.out.println("KEYCHAIN ADDED");
}
public static void removeKey(){
System.out.println("KEYCAHIN REMOVED");
}
public static void viewOrder(){
System.out.println("VIEW ORDER");
}
public static void checkOut(){
System.out.println("CHECKOUT");
}
}
Picture of the output