fork(5) 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 espressoPrice = 40;
  14. int lattePrice = 120;
  15. int waterPrice = 20;
  16. int milkPrice = 35;
  17.  
  18. boolean canBuyAnything = false;
  19.  
  20. if(moneyAmount >= espressoPrice) {
  21. canBuyAnything = true;
  22. System.out.println("Вы можете купить эспрессо");
  23. }
  24.  
  25. if(moneyAmount >= lattePrice) {
  26. canBuyAnything = true;
  27. System.out.println("Вы можете купить латте");
  28. }
  29.  
  30. if(moneyAmount >= waterPrice) {
  31. canBuyAnything = true;
  32. System.out.println("Вы можете купить воду");
  33. }
  34.  
  35. if(moneyAmount >= milkPrice) {
  36. canBuyAnything = true;
  37. System.out.println("Вы можете купить молоко");
  38. }
  39. }
  40. }
Success #stdin #stdout 0.05s 27728KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить эспрессо
Вы можете купить воду
Вы можете купить молоко