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