?
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int speedLimit,speed,fine;
speedLimit=sc.nextInt();
speed=sc.nextInt();
if(speed<=speedLimit)
System.out.println("Congratulations, you are within the speed limit!");
else if(speed-speedLimit>=1 && speed-speedLimit<=20)
System.out.println("You are speeding and your fine is 100.");
else if(speed-speedLimit>=21 && speed-speedLimit<=30)
System.out.println("You are speeding and your fine is 270.");
else
System.out.println("You are speeding and your fine is 500.");
}
}
|