/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
{
system.
out.
println("Система расчёта штрафов");
check(60, 0);
check(90, 500);
check(110, 1000);
check(130, 2000);
check(150, 5000);
check(79, 0);
check(80, 500);
check(99, 500);
check(100, 1000);
check(119, 1000);
}
public static void check(int carSpeed, int fine)
{
if(calculateFine(carSpeed) != fine) {
system.
out.
println("Неверный штраф " + fine +
" для скорости " + carSpeed
);
}
else {
system.
out.
println("Штраф " + fine +
" для скорости " + carSpeed +
" рассчитан верно");
}
}
public static int calculateFine(int carSpeed)
{
int fineFor20to40 = 500;
int fineFor40to60 = 1000;
int fineFor60to80 = 2000;
int fineFor80andMore = 5000;
int townSpeed = 60;
int overSpeed = carSpeed - townSpeed;
if(overSpeed < 20) {
return 0;
}
if(overSpeed >= 20 && overSpeed < 40) {
return fineFor20to40;
}
if(overSpeed >= 40 && overSpeed < 60) {
return fineFor40to60;
}
if(overSpeed >= 60 && overSpeed < 80) {
return fineFor60to80;
}
return fineFor80andMore;
}
}