fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Coffe");
  13.  
  14. int moneyAmount = 100;
  15.  
  16. int espressoPrice = 70;
  17. int cappuchinoPrice = 120;
  18. int waterPrice = 45;
  19.  
  20. boolean price = false;
  21.  
  22. if(moneyAmount >= espressoPrice)
  23. {
  24. System.out.println("Вы можете купить еспрессо");
  25. price = true;
  26. }
  27.  
  28. if(moneyAmount >= cappuchinoPrice)
  29. {
  30. System.out.println("Вы можете купить капучино");
  31. price = true;
  32. }
  33.  
  34. if(moneyAmount >= waterPrice)
  35. {
  36. System.out.println("Вы можете купить воду");
  37. price = true;
  38. }
  39.  
  40. if(price == false)
  41. {
  42. System.out.println("Недостаточно средств");
  43. }
  44. }
  45. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
Coffe
Вы можете купить еспрессо
Вы можете купить воду