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