/**
 * This function checks if a vehicle is speeding, and whether the driver's license and insurance are valid.
 * The function also returns different messages based on various conditions.
 */
fun checkVehicleSpeed(speed: Int, isLicenseValid: Boolean, isInsuranceValid: Boolean): String {

    return when {
        speed > 80 -> {
            when {
                isLicenseValid -> {
                    when {
                        isInsuranceValid -> "Your license and insurance are valid, but you are still speeding!"
                        else -> "Your license is valid, but your insurance has expired. Please drive carefully."
                    }
                }
                else -> {
                    when {
                        isInsuranceValid -> "Your license has expired, but your insurance is still valid. Please renew your license."
                        else -> "Both your license and insurance have expired. You need to resolve this immediately."
                    }
                }
            }
        }
        else -> {
            when {
                isLicenseValid -> {
                    when {
                        isInsuranceValid -> "You are driving within the speed limit, and your license and insurance are valid. Great job!"
                        else -> "You are driving within the speed limit, your license is valid, but your insurance has expired."
                    }
                }
                else -> {
                    return "You are driving within the speed limit, your insurance is valid, but your license has expired. Please renew your license."
                }
            }
        }
    }
}
/**
 * This function checks if a vehicle is speeding, and whether the driver's license and insurance are valid.
 * The function also returns different messages based on various conditions.
 */
fun checkVehicleSpeed(speed: Int, isLicenseValid: Boolean, isInsuranceValid: Boolean): String {
/**
 * This function checks if a vehicle is speeding, and whether the driver's license and insurance are valid.
 * The function also returns different messages based on various conditions.
 */
fun checkVehicleSpeed(speed: Int, isLicenseValid: Boolean, isInsuranceValid: Boolean): String {

    return when {
        speed > 80 -> {
            when {
                isLicenseValid -> {
                    when {
                        isInsuranceValid -> "Your license and insurance are valid, but you are still speeding!"
                        else -> "Your license is valid, but your insurance has expired. Please drive carefully."
                    }
                }
                else -> {
                    when {
                        isInsuranceValid -> "Your license has expired, but your insurance is still valid. Please renew your license."
                        else -> "Both your license and insurance have expired. You need to resolve this immediately."
                    }
                }
            }
        }
        else -> {
            when {
                isLicenseValid -> {
                    when {
                        isInsuranceValid -> "You are driving within the speed limit, and your license and insurance are valid. Great job!"
                        else -> "You are driving within the speed limit, your license is valid, but your insurance has expired."
                    }
                }
                else -> {
                    return "You are driving within the speed limit, your insurance is valid, but your license has expired. Please renew your license."
                }
            }
        }
    }
}