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 moneyAmount = 10;
  15.  
  16. int espressoPrice = 60;
  17. int americanoPrice = 80;
  18. int milkPrice = 50;
  19. int lattePrice = 150;
  20. int waterPrice = 20;
  21. int milkPrice = 30;
  22.  
  23. boolean canBuyAnything = false;
  24.  
  25. if(moneyAmount >= milkPrice)
  26. {
  27. System.out.println("Вы можете купить молоко");
  28. canBuyAnything = true;
  29. }
  30.  
  31.  
  32. if(moneyAmount >= espressoPrice)
  33. {
  34. System.out.println("Вы можете купить эспрессо");
  35. canBuyAnything = true;
  36. }
  37.  
  38. if(moneyAmount >= americanoPrice)
  39. {
  40. System.out.println("Вы можете купить американо");
  41. canBuyAnything = true;
  42. }
  43.  
  44. if(moneyAmount >= lattePrice)
  45. {
  46. System.out.println("Вы можете купить латте");
  47. canBuyAnything = true;
  48. }
  49.  
  50. if(moneyAmount >= waterPrice)
  51. {
  52. System.out.println("Вы можете купить воду");
  53. canBuyAnything = true;
  54. }
  55.  
  56. if(moneyAmount <= 20) {
  57. System.out.println("Недостаточно средств!");
  58. }
  59. }
  60. }
Compilation error #stdin compilation error #stdout 0.07s 2184192KB
stdin
Standard input is empty
compilation info
Main.java:21: error: variable milkPrice is already defined in method main(String[])
    		int milkPrice = 30;
    		    ^
1 error
stdout
Standard output is empty