fork download
  1. import java.util.Scanner;
  2.  
  3. class Exercise2{
  4. public static void main ( String[] args )
  5. {
  6.  
  7. Scanner scan = new scanner( System.in );
  8. int Bolt;
  9. int Washer;
  10. int Nut;
  11. int Price;
  12.  
  13. Price = Bolt * 5 + Nut * 3 + Washer;
  14. System.out.println("Enter amount of bolt(s): ");
  15. Bolt = scan.nextInt();
  16.  
  17. System.out.println("Enter amount of nut(s): ");
  18. Nut = scan.nextInt();
  19.  
  20. System.out.println("Enter amount of washer(s): ");
  21. Washer = scan.nextInt();
  22.  
  23. if (Nut < Bolt)
  24. {
  25. System.out.println("Please check your order: Too few nuts");
  26. }
  27. {
  28. if (Nut >= Bolt && Washer >= Bolt * 2)
  29. {
  30. System.out.println("Order is OK.");
  31. }
  32. }
  33. {
  34. if( Nut < Bolt || Washer != Bolt * 2)
  35. {
  36. System.out.println("Please check your order: too few washers");
  37. }
  38.  
  39. System.out.println("Your total price is: " + Price);
  40. }
  41. }
  42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: cannot find symbol
symbol  : class scanner
location: class Exercise2
Scanner scan = new scanner( System.in );
                   ^
1 error
stdout
Standard output is empty