fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Кофе-машина");
  13. // InputStreamReader inputStream= new InputStreamReader(System.in);
  14. // BufferedReader br = new BufferedReader(inputStream);
  15. //
  16. // int moneyAmount = Integer.parseInt(br.readLine());
  17. int moneyAmount = 33;
  18. int espressoPrice = 40;
  19. int cappucinoPrice = 120;
  20. int waterPrice = 20;
  21. int milkPrice = 33;
  22. boolean canBuyAnything = false;
  23.  
  24. if(moneyAmount>=waterPrice)
  25. {
  26. System.out.println("Вы можете купить Воду");
  27. canBuyAnything=true;
  28. }
  29. if(moneyAmount>=milkPrice)
  30. {
  31. System.out.println("Вы можете купить Молоко");
  32. canBuyAnything=true;
  33. }
  34.  
  35. if(moneyAmount>=espressoPrice)
  36. {
  37. System.out.println("Вы можете купить Эспрессо");
  38. canBuyAnything=true;
  39. }
  40. if(moneyAmount>=cappucinoPrice)
  41. {
  42. System.out.println("Вы можете купить Капучино");
  43. canBuyAnything=true;
  44. }
  45. if (!canBuyAnything) System.out.println("Нужно больше золота!");
  46.  
  47. }
  48. }
Success #stdin #stdout 0.1s 27772KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить Воду
Вы можете купить Молоко