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.  
  14. int moneyAmount = 14;
  15.  
  16. System.out.println("Вы внесли " + moneyAmount + " руб.");
  17.  
  18. int cappucinoPrice = 150;
  19. int espressoPrice = 80;
  20. int waterPrice = 20;
  21. int milkPrice = 49 ;
  22.  
  23. boolean canBuySomething = false;
  24.  
  25. if (moneyAmount >= cappucinoPrice) {
  26. System.out.println("Вы можете купить капучино");
  27. canBuySomething = true;
  28. }
  29.  
  30. if (moneyAmount >= espressoPrice) {
  31. System.out.println("Вы можете купить эспрессо");
  32. canBuySomething = true;
  33. }
  34. if (moneyAmount >= waterPrice) {
  35. System.out.println("Вы можете купить воду");
  36. canBuySomething = true;
  37. }
  38. if (moneyAmount >= milkPrice) {
  39. System.out.println("Вы можете купить молоко");
  40. canBuySomething = true;
  41. }
  42.  
  43. if(canBuySomething == false) {
  44. System.out.println("Еще добавьте, не хватает средств)");
  45. }
  46. }
  47. }
Success #stdin #stdout 0.12s 50200KB
stdin
Standard input is empty
stdout
Кофе-Машина
Вы внесли 14 руб.
Еще добавьте, не хватает средств)