import java.util.*;

public class UnitedStates {
	final static String owner = "Raymond Abes Pamolagan";
	static double result;
	static double results;
	static String coffeeName = "";
	static String coffeeNames = "";
	static String coffeeNamees = "";
	static double coffeePrice;
	static int Items;
	static String name;
	static int money;
	final static String male = "sir";
	final static String female = "maam";
	static String gender;
	static double total;
	static double totals;
	static String cof1 = "Espresso's Coffee";
	static String cof2 = "Latte's Coffee";
	static String cof3 = "Tea's Coffee";
	static boolean order = true; 
	static Scanner cmd = new Scanner(System.in);
	static double subtotal;
	static double subtotals;
	static double subtotales;

	
	public static void menu() {
		System.out.println("------------------------Welcome to Raymond's Coffee shop------------------------\n\n");
		System.out.println("Are you a '"+male+"'"+ " or '"+female+"'"+"?");
		gender = cmd.next();
 }
	public static int List1() {
		System.out.println("You've choose " +cof1);
		System.out.println("Please choose wisely!");	
		System.out.println("");
		System.out.println("1. Espresso \t\t(?250.75)\r\n" + 
				"2. Macchiato \t\t(?230.50)\r\n" + 
				"3. Cappuccino \t\t(?200.00)\r\n" + 
				"4. Americano \t\t(?180.00)\r\n" + 
				"5. Caramel Macchiato \t(?175.00)");
		Items = cmd.nextInt();
		if(Items >= 5) {
			System.out.println("Invalid option!");
			return Items;
		}
		if (Items == 1) {
			coffeeName = "Espresso";
			System.out.println("You've choose Espresso coffee.");
			coffeePrice = 250.75;
		}
		if (Items == 2) {
			coffeeName = "Macchiato";
			System.out.println("You've choose Macchiato coffee.");
			coffeePrice = 230.50;	
		}
		if (Items == 3) {
			coffeeName = "Cappuccino";
			System.out.println("You've choose Capuccino coffee.");
			coffeePrice = 200.00;
		}
		if (Items == 4) {
			coffeeName = "Americano";
			System.out.println("You've choose Americano coffee.");
			coffeePrice = 180.00;
		}	
		if (Items == 5) {
			coffeeName = "Caramel Macchiato";
			System.out.println("You've choose Caramel coffee.");
			coffeePrice = 175.00;
		}
		quantity(Items);
		return Items;
	}	
	public static int List2(){
		System.out.println("You've choose " +cof2);
		System.out.println("Please choose wisely!");	
		System.out.println("");
		System.out.println("1. Cafe Latte \t\t\t\t(?340.50)\r\n" + 
				"2. Mocha Latte \t\t\t\t(?320.75)\r\n" + 
				"3. Vanilla Latte \t\t\t(?252.25)\r\n" + 
				"4. Double Chocolate Latte \t\t(?180.00)\r\n" + 
				"5. White Chocolate Dream® Latte \t(?200.00)\r\n" + 
				"6. Hazelnut Latte \t\t\t(?299.99)");
		Items = cmd.nextInt();
		if(Items >= 7) {
			System.out.println("Invalid option!");
			return Items;
		}
		if (Items == 1) {
			coffeeNames = "Cafe Latte";
			System.out.println("You've choose Caffe latte.");
			coffeePrice = 340.50;
		}
		if (Items == 2) {
			coffeeNames = "Mocha Latte";
			System.out.println("You've choose Mocha latte.");
			coffeePrice = 320.75;	
		}
		if (Items == 3) {
			coffeeNames = "Vanilla Latte";
			System.out.println("You've choose Vanilla latte.");
			coffeePrice = 252.25;
		}
		if (Items == 4) {
			coffeeNames = "Double Chocolate Latte";
			System.out.println("You've choose Double Chocolate latte.");
			coffeePrice = 180.00;
		}
		if (Items == 5) {
			coffeeNames = "White Chocolate Dream® Latte";
			System.out.println("You've choose White Chocolate Dream® Latte.");
			coffeePrice = 200.00;
		}
		if (Items == 6) {
			coffeeNames = "Hazelnut Latte";
			System.out.println("You've choose Hazelnut latte");
			coffeePrice = 299.99;
		}
		quantity(Items);
		return Items;
	}
	public static int List3() {
		System.out.println("You've choose " +cof3);
		System.out.println("Please choose wisely!");	
		System.out.println("");
		System.out.println("1. Chai Blend \t\t(?500.00)\r\n" + 
				"2. English Breakfast \t(?450.25)\r\n" + 
				"3. Earl Grey \t\t(?340.50)\r\n" + 
				"4. Tropical Passion \t(?300.75)\r\n" + 
				"5. Apricot Ceylon \t(?100.00)\r\n");
		Items = cmd.nextInt();
		if(Items >= 6) {
			System.out.println("Invalid option!");
			return Items;
		}
		if (Items == 1) {
			coffeeNamees = "Chai Blend";
			System.out.println("You've Chai Blend Tea.");
			coffeePrice = 500.00;
		}
		if (Items == 2) {
			coffeeNamees = "English Breakfast";
			System.out.println("You've choose English Breakfast Tea.");
			coffeePrice = 450.25;	
		}
		if (Items == 3) {
			coffeeNamees = "Earl Grey";
			System.out.println("You've choose Earl Grey latte Tea.");
			coffeePrice = 340.50;
		}
		if (Items == 4) {
			coffeeNamees = "Tropical Passion";
			System.out.println("You've choose Tropical Passion Tea.");
			coffeePrice =300.75;
		}	
		if (Items == 5) {
			coffeeNamees = "Apricot Ceylon";
			System.out.println("You've choose  Apricot Ceylon Tea.");
			coffeePrice = 100.00;
		}
		quantity(Items);
		return Items;
	}
	public static int quantity(int coffeeItem){
		System.out.println("Enter a quantity "+gender+": ");
		double quantity = cmd.nextDouble();
		subtotal(quantity, coffeePrice);
		return coffeeItem;
	}
	
	public static double subtotal(double quantity, double coffeeItem) {
		subtotal = quantity * coffeePrice;
		System.out.println("Subtotal = " +"?"+subtotal+"0");
		System.out.println(" ");
		total += subtotal;
		return subtotal;
	}

	public static void done() {
		order = false;
		
		Vector<String> Namelist = new Vector<String>();
		Vector<Double> CoffeeAmtList = new Vector<Double>();
		double sum = 0.0;
		
		Namelist.addElement(name +"\n"+name);
		CoffeeAmtList.addElement(total);
		
		
		for(int i = 0; i<Namelist.size(); i++){
			
			System.out.println(Namelist.elementAt(i)+"\t"+CoffeeAmtList.elementAt(i));
		}
			
		System.out.println("Total bill is: " +"?"+total+"0");
		System.out.println("Enter your money: ");
		money = cmd.nextInt();
		result = (money - total);
		System.out.println("You're change is: " +result+"0");
		System.out.println(" ");
		System.out.println("-------------------------");
		System.out.println("Enjoy your coffee!\nHave a good day "+gender+" \n");
		}
	public static void dones(){
		System.out.println(name+"\nTotal bill is: " +"?"+total+"0");
		System.out.println("Enter your money: ");
		money = cmd.nextInt();
		result = (money - total);
		System.out.println("You're change is: " +result+"0");
		System.out.println(" ");
		System.out.println("-------------------------");
		System.out.println("Enjoy your coffee!\nHave a good day "+gender+" \n");
		
		
	}
	public static void main(String [] args) {
		char choose;
		int menu;
		menu();
		
		
		do {
			System.out.println("Please enter your name "+gender+": ");
			name = cmd.nextLine();
			cmd.nextLine();
			
			System.out.println("\nPlease choose the best coffee which you preffer "+gender+".\n"
				+"1. " + cof1 + "\n2. " + cof2 + "\n3. " + cof3);
			menu = cmd.nextInt();
	
			switch (menu) {
			case 1:
			List1();
			break;
			
			case 2:	
			List2();	
			break;
			
			case 3:	
			List3();	
			break;
			
			default:
				System.out.println("Invalid input...");
			break;
	}
			System.out.println("Do you want to enter another customer? y/n");
			choose = cmd.next().charAt(0);
}		
		
	while(choose == 'y');
		done();
		System.out.println("Thank you!");
		System.out.println("-------------------------");
		System.out.println("-------------------------\n"
				+ "\tTotal: \tPHP "+total+
				  "\n\tCash: \tPHP "+money+
				  "\n\tCost: \tPHP "+result);
	}
}
	
	