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. int moneyAmount = 100;
  11.  
  12. int cappucinoPrice = 150;
  13. int americanoPrice = 80;
  14. int appleJuicePrice = 70;
  15. int milkPrice = 39;
  16. int waterPrice = 25;
  17.  
  18. boolean canBuyAnything = false;
  19.  
  20. if(moneyAmount >= cappucinoPrice) {
  21. System.out.println("Вы можете купить капучино");
  22. canBuyAnything = true;
  23. }
  24.  
  25. if(moneyAmount >= americanoPrice) {
  26. System.out.println("Вы можете купить американо");
  27. canBuyAnything = true;
  28. }
  29.  
  30. if(moneyAmount >= appleJuicePrice) {
  31. System.out.println("Вы можете купить яблочный сок");
  32. canBuyAnything = true;
  33. }
  34.  
  35. if(moneyAmount >= milkPrice) {
  36. System.out.println("Вы можете купить молоко");
  37. canBuyAnything = true;
  38. }
  39.  
  40. if(moneyAmount >= appleJuicePrice) {
  41. System.out.println("Вы можете купить воду");
  42. canBuyAnything = true;
  43. }
  44. if(canBuyAnything == false) {
  45. System.out.println("Не достаточно средств");
  46. canBuyAnything = true;
  47. }
  48.  
  49. }
  50. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить американо
Вы можете купить яблочный сок
Вы можете купить молоко
Вы можете купить воду