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