-
Notifications
You must be signed in to change notification settings - Fork 6
commit #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
commit #3
Conversation
src/coffeeMachine/Main.java
Outdated
| int coffee = cups * 15; | ||
| System.out.print("Write how many cups of coffee you will need: "); | ||
| System.out.println(cups); | ||
| System.out.print ("For "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that it is good to use an additional space after print (before parentheses).
It is better to write System.out.print("For ");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to give more descriptive names of your commits rather than commit and again.
|
Check if there are enough resources |
| if( min==cups) { | ||
| System.out.println("Yes, I can make that amount of coffee"); | ||
| } | ||
| if( min<cups) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is it better to use if-else construction here?
| int coffee = scanner.nextInt(); | ||
| System.out.println ("Write how many cups of coffee you will need: "); | ||
| int cups = scanner.nextInt(); | ||
| int amount_w = water/200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Java, it is better to add one space between an operator and operands like water / 200;
|
Thank you very much, Artyom! :)
Отправлено из мобильной Почты Mail.Ru
среда, 17 октября 2018 г., 17:06 +0300 от notifications@github.com <notifications@github.com>:
…
@artyom-b commented on this pull request.
----------------------------------------------------------------------
In src/coffeeMachine/Main.java :
> +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]<min)
+ {
+ min = amount[i];
+ }
+}
+
+ if( min==cups) {
+ System.out.println("Yes, I can make that amount of coffee");
+ }
+ if( min<cups) {
Maybe is it better to use if-else construction here?
----------------------------------------------------------------------
In src/coffeeMachine/Main.java :
> public class Main {
public static void main(String[] args) {
- System.out.print("Hello world!");
+ 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 amount_w = water/200;
In Java, it is better to add one space between an operator and operands like water / 200 ;
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .
|
No description provided.