fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. int moneyAmount = 500;
  14.  
  15.  
  16. System.out.println("Кофе-машина");
  17.  
  18.  
  19. int mineralWaterPrice = 20;
  20. int teaPrice = 30;
  21. int americanoPrice = 100;
  22. int coppucinoPrice = 150;
  23. int milkPrice = 25;
  24.  
  25. boolean canBuyAnything = false;
  26.  
  27.  
  28. if (moneyAmount >= mineralWaterPrice) {
  29. System.out.println("Вы можете купить минеральную воду");
  30. canBuyAnything = true;
  31. }
  32. if (moneyAmount >= teaPrice) {
  33. System.out.println("Вы можете купить чай");
  34. canBuyAnything = true;
  35. }
  36. if (moneyAmount >= americanoPrice) {
  37. System.out.println("Вы можете купить американо");
  38. canBuyAnything = true;
  39. }
  40. if (moneyAmount >= coppucinoPrice) {
  41. System.out.println("Вы можете купить капучино");
  42. canBuyAnything = true;
  43. }
  44. if (moneyAmount >= coppucinoPrice) {
  45. System.out.println("Вы можете купить молоко");
  46. canBuyAnything = true;
  47. }
  48. if(canBuyAnything == false) {
  49. System.out.println("Недостаточно средств! РАБОТАТЬ!");
  50. }
  51.  
  52.  
  53. }
  54. }
Success #stdin #stdout 0.1s 27740KB
stdin
Standard input is empty
stdout
Кофе-машина
Вы можете купить минеральную воду
Вы можете купить чай
Вы можете купить американо
Вы можете купить капучино
Вы можете купить молоко