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