fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. System.out.println("Кофе-машина");
  10.  
  11. int moneyAmount = 100;
  12.  
  13. int waterPrice = 20;
  14. int espressoPrice = 60;
  15. int cappucinoPrice = 120;
  16. int lattePriсe = 100;
  17. boolean canBuyAnything = false;
  18.  
  19. if(moneyAmount >= waterPrice) {
  20. System.out.println("Вы можете купить воду");
  21. canBuyAnything = true;
  22. }
  23.  
  24. if(moneyAmount >= espressoPrice) {
  25. System.out.println("Вы можете купить эспрессо");
  26. canBuyAnything = true;
  27. }
  28.  
  29. if(moneyAmount >= cappucinoPrice) {
  30. System.out.println("Вы можете купить капучино");
  31. canBuyAnything = true;
  32. }
  33.  
  34. if(moneyAmount >= lattePriсe) {
  35. System.out.println("Вы можете купить латте");
  36. canBuyAnything = true;
  37. }
  38. if(!canBuyAnything) {
  39. System.out.println("Недостаточно средств");
  40. }
  41. }
  42. }
Success #stdin #stdout 0.09s 27820KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить воду
Вы можете купить эспрессо
Вы можете купить латте