fork(2) 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 = 120;
  14. int lattePrice = 80;
  15. int espressoPrice = 50;
  16. int cacaoPrice = 89;
  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. if(moneyAmount >= espressoPrice)
  35. {
  36. System.out.println("Вы можете купить эспрессо");
  37. canBuyAnything = true;
  38. }
  39. if(moneyAmount >= cacaoPrice)
  40. {
  41. System.out.println("Вы можете купить какао");
  42. canBuyAnything = true;
  43. }
  44. if(!canBuyAnything) {
  45. System.out.println("Недостаточно средств :(");
  46. }
  47. }
  48. }
Success #stdin #stdout 0.05s 27604KB
stdin
Standard input is empty
stdout
Кофе-машина
Недостаточно средств :(