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.  
  10. System.out.println("Кофе-машина");
  11.  
  12. int moneyAmount = 100;
  13.  
  14. int cappucinoPrice = 120;
  15. int espressoPrice = 80;
  16. int waterPrice = 20;
  17. int milkPrice = 15;
  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(!canBuyAnything) {
  42. System.out.println("Вы не можете ничего купить! Учите джаву и идите работать!");
  43. }
  44. }
  45. }
Success #stdin #stdout 0.09s 27664KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить эспрессо!
Вы можете купить воду!
Вы можете купить молоко!