From 8007d447263da4ffe9d6dc4a6984623d4bebdba8 Mon Sep 17 00:00:00 2001 From: DianaBogdanova98 Date: Sun, 14 Oct 2018 20:29:16 +0300 Subject: [PATCH 1/3] commit --- .idea/misc.xml | 2 +- src/coffeeMachine/Main.java | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index a165cb3..35bdbab 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/coffeeMachine/Main.java b/src/coffeeMachine/Main.java index 39e98c9..2cba422 100644 --- a/src/coffeeMachine/Main.java +++ b/src/coffeeMachine/Main.java @@ -1,7 +1,23 @@ package coffeeMachine; - +import java.util.Scanner; public class Main { public static void main(String[] args) { - System.out.print("Hello world!"); + Scanner scanner = new Scanner(System.in); + int cups = scanner.nextInt(); + int water = cups * 200; + int milk = cups * 50; + int coffee = cups * 15; + System.out.print("Write how many cups of coffee you will need: "); + System.out.println(cups); + System.out.print ("For "); + System.out.print (cups); + System.out.println (" cups you will need: "); + System.out.print (water); + System.out.println (" ml of water"); + System.out.print (milk); + System.out.println (" ml of milk "); + System.out.print (coffee); + System.out.println(" g of coffee beans"); + } } \ No newline at end of file From 3e2463ee039f182e735c28061c69daa4e072e54c Mon Sep 17 00:00:00 2001 From: DianaBogdanova98 Date: Sun, 14 Oct 2018 20:36:32 +0300 Subject: [PATCH 2/3] again --- src/coffeeMachine/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coffeeMachine/Main.java b/src/coffeeMachine/Main.java index 2cba422..4d9e150 100644 --- a/src/coffeeMachine/Main.java +++ b/src/coffeeMachine/Main.java @@ -11,7 +11,7 @@ public static void main(String[] args) { System.out.println(cups); System.out.print ("For "); System.out.print (cups); - System.out.println (" cups you will need: "); + System.out.println (" cups of coffee you will need: "); System.out.print (water); System.out.println (" ml of water"); System.out.print (milk); From bb455dbf65d45b3bc7e018690208e8ed36a1bfc6 Mon Sep 17 00:00:00 2001 From: DianaBogdanova98 Date: Tue, 16 Oct 2018 18:07:58 +0300 Subject: [PATCH 3/3] Check --- src/coffeeMachine/Main.java | 47 ++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/coffeeMachine/Main.java b/src/coffeeMachine/Main.java index 4d9e150..4307eab 100644 --- a/src/coffeeMachine/Main.java +++ b/src/coffeeMachine/Main.java @@ -3,21 +3,40 @@ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); + System.out.println("Write how many ml of water the coffee machine has: "); + int water = scanner.nextInt(); + System.out.println ("Write how many ml of milk the coffee machine has: "); + int milk = scanner.nextInt(); + System.out.println ("Write how many grams of coffee beans the coffee machine has: "); + int coffee = scanner.nextInt(); + System.out.println ("Write how many cups of coffee you will need: "); int cups = scanner.nextInt(); - int water = cups * 200; - int milk = cups * 50; - int coffee = cups * 15; - System.out.print("Write how many cups of coffee you will need: "); - System.out.println(cups); - System.out.print ("For "); - System.out.print (cups); - System.out.println (" cups of coffee you will need: "); - System.out.print (water); - System.out.println (" ml of water"); - System.out.print (milk); - System.out.println (" ml of milk "); - System.out.print (coffee); - System.out.println(" g of coffee beans"); +int amount_w = water/200; +int amount_m = milk/50; +int amount_c = coffee-cups /15; +int[] amount = {amount_w,amount_m,amount_c}; +int min = amount[0]; +for (int i=0;i<3;i++) +{ + if (amount[i]cups) { + System.out.println("Yes, I can make that amount of coffee (and even "); + System.out.print(min-cups); + System.out.println(" more than that)"); + } } } \ No newline at end of file