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