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