fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.Scanner;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. System.out.println("Кофе-машина");
  11. Scanner s = new Scanner(System.in);
  12.  
  13. System.out.println("Кол-во денег в кармане:" + s.nextLine());
  14. int moneyAmount = s.nextInt();
  15.  
  16. int cappucinoPrice = 120;
  17. int espressoPrice = 80;
  18. int waterPrice = 20;
  19. int milkPrice = 43;
  20.  
  21. boolean canBuyAnything = false;
  22.  
  23. if(cappucinoPrice <= moneyAmount) {
  24. System.out.println("Вы можете купить капучино!");
  25. canBuyAnything = true;
  26. }
  27.  
  28. if(milkPrice <= moneyAmount) {
  29. System.out.println("Вы можете купить молоко!");
  30. canBuyAnything = true;
  31. }
  32.  
  33. if(espressoPrice <= moneyAmount) {
  34. System.out.println("Вы можете купить эспрессо!");
  35. canBuyAnything = true;
  36. }
  37.  
  38. if(waterPrice <= moneyAmount) {
  39. System.out.println("Вы можете купить воду!");
  40. canBuyAnything = true;
  41. }
  42.  
  43. if(!canBuyAnything) {
  44. System.out.println("Вы не можете ничего купить! Учите джаву и идите работать!");
  45. }
  46. }
  47. }
Compilation error #stdin compilation error #stdout 0.12s 29316KB
stdin
30
compilation info
Main.java:14: error: incompatible types: String cannot be converted to int
		int moneyAmount = s.nextLine();
		                            ^
Main.java:15: error: cannot find symbol
		moneyAmount = Integer.presInt();
		                     ^
  symbol:   method presInt()
  location: class Integer
2 errors
stdout
Standard output is empty