fork(1) 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 = 150;
  12.  
  13. int espressoPrice = 85;
  14. int waterPrice = 20;
  15. int lattePrice = 180;
  16. int cappuccinoPrice = 140;
  17. //======================================================
  18.  
  19. boolean canBuyAnything = false;
  20.  
  21. if(moneyAmount >= espressoPrice) {
  22. System.out.println("Вы можете купить эспрессо");
  23. canBuyAnything = true;
  24. }
  25.  
  26. if(moneyAmount >= waterPrice) {
  27. System.out.println("Вы можете купить воду");
  28. canBuyAnything = true;
  29. }
  30.  
  31. if(moneyAmount >= lattePrice) {
  32. System.out.println("Вы можете купить латте");
  33. canBuyAnything = true;
  34. }
  35.  
  36. if(moneyAmount >= cappuccinoPrice) {
  37. System.out.println("Вы можете купить капучино");
  38. canBuyAnything = true;
  39. }
  40.  
  41. if(!canBuyAnything) {
  42. System.out.println("Недостаточно средств");
  43. }
  44. }
  45. }
Success #stdin #stdout 0.09s 27836KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить эспрессо
Вы можете купить воду
Вы можете купить капучино