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