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