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