fork(1) 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. System.out.println("Кофе-машина");
  13.  
  14. int myArray[];
  15. myArray = new int[4];
  16.  
  17. int moneyAmount = 12;
  18.  
  19. for (int i = 0; i < 4; i++)
  20. {
  21. myArray[0] = 80;
  22. myArray[1] = 150;
  23. myArray[2] = 20;
  24. myArray[3] = 50;
  25. }
  26.  
  27. boolean canBuyAnything = false;
  28.  
  29. if(moneyAmount >= myArray[0]) {
  30. System.out.println("Вы можете купить эспрессо");
  31. canBuyAnything = true;
  32. }
  33.  
  34. if(moneyAmount >= myArray[1]) {
  35. System.out.println("Вы можете купить капучино");
  36. canBuyAnything = true;
  37. }
  38.  
  39. if(moneyAmount >= myArray[2]) {
  40. System.out.println("Вы можете купить воду");
  41. canBuyAnything = true;
  42. }
  43.  
  44. if(moneyAmount >= myArray[3]) {
  45. System.out.println("Вы можете купить молоко");
  46. canBuyAnything = true;
  47. }
  48.  
  49. if(canBuyAnything == false) {
  50. System.out.println("Недостаточно средств :( Учите джаву и зарабатывайте много! :))");
  51. }
  52. }
  53. }
Success #stdin #stdout 0.06s 32680KB
stdin
Standard input is empty
stdout
Кофе-машина
Недостаточно средств :( Учите джаву и зарабатывайте много! :))