fork download
  1. public class Main
  2. {
  3. public static void main(String[] args) {
  4. System.out.println("Система расчёта штрафов");
  5.  
  6. int carSpeed = 187;
  7.  
  8. int fineFor20to40 = 500;
  9. int fineFor40to60 = 1000;
  10. int fineFor60to80 = 2000;
  11. int fineFor80andMore = 5000;
  12.  
  13. int townSpeed = 60;
  14.  
  15. int overSpeed = carSpeed - townSpeed;
  16.  
  17. if(overSpeed < 20) {
  18. System.out.println("Скорость не превышена или превышена незначительно");
  19. }
  20. else if(overSpeed >= 20 && overSpeed < 40) {
  21. System.out.println("Штраф: " + fineFor20to40);
  22. }
  23. else if(overSpeed >= 40 && overSpeed < 60) {
  24. System.out.println("Штраф: " + fineFor40to60);
  25. }
  26. else if(overSpeed >= 60 && overSpeed < 80) {
  27. System.out.println("Штраф: " + fineFor60to80);
  28. }
  29. else if(overSpeed >= 80) {
  30. System.out.println("Штраф: " + fineFor80andMore);
  31. }
  32. }
  33. }
Success #stdin #stdout 0.1s 53688KB
stdin
Standard input is empty
stdout
Система расчёта штрафов
Штраф: 5000