├── .idea ├── .gitignore ├── vcs.xml ├── misc.xml ├── modules.xml └── uiDesigner.xml ├── out └── production │ └── Redi_Coffee_Machine.Java │ ├── Drinks.class │ ├── CoffeeMachine.class │ └── IngredientsProcessing.class ├── Redi_Coffee_Machine.Java.iml └── src ├── CoffeeMachine.java └── IngredientsProcessing.java /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml -------------------------------------------------------------------------------- /out/production/Redi_Coffee_Machine.Java/Drinks.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drFabio/Redi_Coffee_Machine.Java_Project_1/master/out/production/Redi_Coffee_Machine.Java/Drinks.class -------------------------------------------------------------------------------- /out/production/Redi_Coffee_Machine.Java/CoffeeMachine.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drFabio/Redi_Coffee_Machine.Java_Project_1/master/out/production/Redi_Coffee_Machine.Java/CoffeeMachine.class -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /out/production/Redi_Coffee_Machine.Java/IngredientsProcessing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drFabio/Redi_Coffee_Machine.Java_Project_1/master/out/production/Redi_Coffee_Machine.Java/IngredientsProcessing.class -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Redi_Coffee_Machine.Java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/CoffeeMachine.java: -------------------------------------------------------------------------------- 1 | // Project : Redi`s member Secured Coffee Machine ; 2 | // Programmed by : Beny 3 | // Function : Provide 4 types of coffee and used only by Redi members **secured** used only with code.(password) 4 | // HINT: cheat sheet for coffee types available and free to every Redi Member; 5 | 6 | 7 | import java.util.*; 8 | 9 | class CoffeeMachine { 10 | 11 | public static void main(String[] args) { 12 | 13 | Scanner input = new Scanner(System.in); 14 | System.out.println("\n Start the Machine Yes (Y) or No (N) ?"); 15 | 16 | 17 | char b; 18 | 19 | b = input.next().charAt(0); 20 | 21 | if (b == 'Y' || b == 'y') { 22 | IngredientsProcessing ingredients = new IngredientsProcessing(); //Instances For Ingredients 23 | ingredients.StartMachine(); 24 | 25 | //In order to call All Private Method... 26 | System.out.println("Shutting Down machine..\n"); 27 | } else 28 | System.out.println("Shutting Down machine...\n"); 29 | 30 | 31 | } 32 | 33 | 34 | } 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/IngredientsProcessing.java: -------------------------------------------------------------------------------- 1 | 2 | import java.util.Scanner; 3 | 4 | 5 | public class IngredientsProcessing { 6 | 7 | static Scanner input = new Scanner(System.in); 8 | private double water; 9 | private double grind; 10 | private double milk; 11 | private double ice; 12 | private int Count = 0; 13 | 14 | public IngredientsProcessing() { // calling for all ingredients. 15 | this.milk = 0; 16 | this.water = 0; 17 | this.grind = 0; 18 | } 19 | 20 | private void EnterIngredient() { //calling for putting Ingredients 21 | System.out.println("\n putting.."); 22 | this.grind = 250; 23 | this.milk = 1; 24 | this.water = 1; 25 | this.ice = 2; 26 | System.out.println("putting Completed you can make coffee now."); 27 | } 28 | 29 | private void GetIngredient() { //To Get Status 30 | System.out.println(" Coffee grind (g) " + String.format("%.1f", this.grind)); 31 | System.out.println(" Milk(L) " + String.format("%.1f", this.milk)); 32 | System.out.println(" Water(L) " + String.format("%.1f", this.water)); 33 | } 34 | 35 | private void CoffeeMenu() { //Coffee Selection Menu 36 | System.out.println("\n ------------------ "); 37 | System.out.println("| Select Type of coffee: |\n ------------------ \n| 1: Expresso |\n| 2: Latte |\n| 3: Ice |\n| 4: Drip |\n| 0 to Cancell |"); 38 | System.out.println(" ------------------ \n"); 39 | 40 | char t = input.next().charAt(0); 41 | Drinks currentDrink = null; 42 | switch (t) { 43 | case '1': 44 | currentDrink = Drinks.makeEspresso();//Calling Expresso Method 45 | break; 46 | case '2': 47 | currentDrink = Drinks.makeLatte(); //Calling Latte Method 48 | break; 49 | case '3': 50 | this.Ice(); //Calling Ice Method 51 | break; 52 | case '4': 53 | currentDrink = Drinks.makeDrip(); 54 | break; 55 | 56 | case '0': // cancelling 57 | break; 58 | 59 | } 60 | if (currentDrink != null) { 61 | processDrink(currentDrink); 62 | } 63 | } 64 | 65 | private void processDrink(Drinks drink) { 66 | if (this.grind >= drink.coffee && this.water >= drink.water && this.milk >= drink.milk) { 67 | System.out.println("\nMaking " + drink.name + ".."); 68 | System.out.println("\nTaking " + drink.coffee + "g of grind."); 69 | this.grind = this.grind - drink.coffee; 70 | System.out.println("Taking " + drink.water + " of water."); 71 | this.water -= drink.water; 72 | System.out.println("\nYour " + drink.name + " is Ready."); 73 | this.Count++; 74 | } else { 75 | System.out.println("\nAvailable grind " + (this.grind)); 76 | System.out.println("Available water " + (this.water)); 77 | System.out.println("\nmissing some ingredients, please put."); 78 | } 79 | } 80 | 81 | private void Ice() { // Ice making Method 82 | if (this.grind >= 5 && this.ice >= 1) { 83 | System.out.println("\nMaking Ice coffee..."); 84 | System.out.println("\nTaking 5g of grind."); 85 | this.grind = this.grind - 5; 86 | System.out.println("Taking 1 block of ice."); 87 | this.ice = this.ice - 1; 88 | System.out.println("\nYour ice Coffee is Ready."); 89 | this.Count++; 90 | } else { 91 | System.out.println("\nAvailable grind " + (this.grind)); 92 | System.out.println("Available ice " + (this.ice)); 93 | System.out.println("\nmissing some ingredients, please put."); 94 | } 95 | } 96 | 97 | public void StartMachine() { //public Start to access all private method of this class 98 | System.out.println(" ----------------------------------------------------------------"); 99 | System.out.println(" ----------------------------------------------------------------"); 100 | 101 | 102 | //System.out.println("Currently We Have Following Operations, Select as your Need:- "); 103 | System.out.println("\nSelect what you need among following operations..: "); 104 | this.GetIngredient(); 105 | boolean t = true; 106 | while (t) { 107 | System.out.println("\n -------------------------------- "); 108 | System.out.println("|1: Status of Ingredient |\n -------------------------------- \n|2: Fill Ingredient |\n -------------------------------- \n|3: Make Coffee |\n -------------------------------- \n|4: How many Coffee We have made?|\n -------------------------------- \n|5: Exit |"); 109 | System.out.println(" -------------------------------- \n\n"); 110 | char c = IngredientsProcessing.input.next().charAt(0); 111 | switch (c) { // for obtaining results.. 112 | case '1': 113 | System.out.println("------------- Status ------------"); 114 | GetIngredient(); 115 | System.out.println("---------------------------------"); 116 | break; 117 | case '2': 118 | this.EnterIngredient(); 119 | break; 120 | case '3': 121 | this.CoffeeMenu(); 122 | break; 123 | case '4': 124 | System.out.println("\nWe Have Made " + this.Count + " Coffees."); 125 | break; 126 | 127 | case '5': 128 | System.out.println("\nExiting...\n"); 129 | t = false; 130 | break; 131 | } 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | --------------------------------------------------------------------------------