/**
 * A police officer needs to check if a car is speeding based on the given speed limit.
 *
 * @param speedLimit The maximum speed limit allowed.
 * @param carSpeed The speed of the car.
 * @return A message indicating if the car is speeding or not, along with the fine amount.
 */
fun checkSpeed(speedLimit: Int, carSpeed: Int): String {

    // Check if the car is speeding
    if (carSpeed > speedLimit) {
        var fine = 0
        val exceeding = carSpeed - speedLimit

        // Determine the fine amount based on the exceeding speed
        fine = when {
            exceeding < 10 -> 100
            exceeding < 20 -> 200
            exceeding < 30 -> 300
            else -> 500
        }

        // Return the message with the fine amount
        return "The car is speeding! Fine amount: $$fine"
    }

    return "The car is within the speed limit."
}
/**
 * A police officer needs to check if a car is speeding based on the given speed limit.
 *
 * @param speedLimit The maximum speed limit allowed.
 * @param carSpeed The speed of the car.
 * @return A message indicating if the car is speeding or not, along with the fine amount.
 */
fun checkSpeed(speedLimit: Int, carSpeed: Int): String {
/**
 * A police officer needs to check if a car is speeding based on the given speed limit.
 *
 * @param speedLimit The maximum speed limit allowed.
 * @param carSpeed The speed of the car.
 * @return A message indicating if the car is speeding or not, along with the fine amount.
 */
fun checkSpeed(speedLimit: Int, carSpeed: Int): String {

    // Check if the car is speeding
    if (carSpeed > speedLimit) {
        var fine = 0
        val exceeding = carSpeed - speedLimit

        // Determine the fine amount based on the exceeding speed
        fine = when {
            exceeding < 10 -> 100
            exceeding < 20 -> 200
            exceeding < 30 -> 300
            else -> 500
        }

        // Return the message with the fine amount
        return "The car is speeding! Fine amount: $$fine"
    }

    return "The car is within the speed limit."
}