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 = 10;
  12.  
  13. int cappucinoPrice = 12;
  14. int lattePrice = 8;
  15. int espressoPrice = 5;
  16. int cacaoPrice = 10;
  17.  
  18. //===================================================
  19.  
  20. boolean canBuyAnything = false;
  21.  
  22. if (moneyAmount >= cappucinoPrice)
  23. {
  24. System.out.println("Вы можете купить каппучино");
  25. canBuyAnything = true;
  26.  
  27. }
  28. if (moneyAmount >= lattePrice)
  29. {
  30. System.out.println("Вы можете купить латте");
  31. canBuyAnything = true;
  32.  
  33.  
  34. }
  35. if (moneyAmount >= espressoPrice)
  36. {
  37. System.out.println("Вы можете купить эспрессо");
  38. canBuyAnything = true;
  39. }
  40.  
  41. if (moneyAmount >= cacaoPrice)
  42. {
  43. System.out.println("Вы можете купить какао");
  44. canBuyAnything = true;
  45. }
  46.  
  47. if (!canBuyAnything){
  48.  
  49. System.out.println("У Вас недостаточно средств");
  50.  
  51. }
  52. }
  53. }
Success #stdin #stdout 0.08s 27776KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить латте
Вы можете купить эспрессо
Вы можете купить какао