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.  
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Система расчёта штрафов");
  13.  
  14. System.out.println(calculateFine(100));
  15.  
  16. int carSpeed = 187;
  17.  
  18. int fineFor20to40 = 500;
  19. int fineFor40to60 = 1000;
  20. int fineFor60to80 = 2000;
  21. int fineFor80andMore = 5000;
  22.  
  23. int townSpeed = 60;
  24.  
  25. int overSpeed = carSpeed - townSpeed;
  26.  
  27. if (overSpeed < 20) {
  28. return 0;
  29.  
  30. } else if (overSpeed >= 20 && overSpeed <= 40) {
  31. return fineFor1to10;
  32.  
  33. } else if (overSpeed >= 40 && overSpeed < 60) {
  34. return fineFor40to60;
  35.  
  36. } else if (overSpeed >= 60 && overSpeed < 80) {
  37. return fineFor60to80;
  38.  
  39. } else {
  40. return fineFor80andMore;
  41. }
  42. }
  43.  
  44. }
  45.  
  46.  
  47.  
  48.  
Compilation error #stdin compilation error #stdout 0.08s 50812KB
stdin
Standard input is empty
compilation info
Main.java:14: error: cannot find symbol
        System.out.println(calculateFine(100));
                           ^
  symbol:   method calculateFine(int)
  location: class Ideone
Main.java:28: error: incompatible types: unexpected return value
           return 0;
                  ^
Main.java:31: error: incompatible types: unexpected return value
              return fineFor1to10;
                     ^
Main.java:34: error: incompatible types: unexpected return value
              return fineFor40to60;
                     ^
Main.java:37: error: incompatible types: unexpected return value
              return fineFor60to80;
                     ^
Main.java:40: error: incompatible types: unexpected return value
              return fineFor80andMore;
                     ^
6 errors
stdout
Standard output is empty