/**
 * Calculates the thrust produced by an aircraft engine based on the throttle setting and atmospheric density.
 *
 * @param throttle Throttle setting, a value between 0 and 1.
 * @param atmosphericDensity The atmospheric density, in kg/m^3.
 * @return The thrust produced by the engine.
 */
fun calculateEngineThrust(throttle: Double, atmosphericDensity: Double): Double {

    val enginePower = 5000.0  // Power output of the engine in watts
    val thrustCoefficient = 0.6  // Efficiency of the engine

    var validThrottle = throttle
    while (true) {
        if (validThrottle < 0 || validThrottle > 1) {
            println("Throttle setting must be between 0 and 1.")
            validThrottle = readLine()?.toDoubleOrNull() ?: 0.0
        } else {
            break
        }
    }

    val thrust = enginePower * thrustCoefficient * validThrottle
    val adjustedThrust = thrust / atmosphericDensity

    return adjustedThrust
}
/**
 * Calculates the thrust produced by an aircraft engine based on the throttle setting and atmospheric density.
 *
 * @param throttle Throttle setting, a value between 0 and 1.
 * @param atmosphericDensity The atmospheric density, in kg/m^3.
 * @return The thrust produced by the engine.
 */
fun calculateEngineThrust(throttle: Double, atmosphericDensity: Double): Double {
/**
 * Calculates the thrust produced by an aircraft engine based on the throttle setting and atmospheric density.
 *
 * @param throttle Throttle setting, a value between 0 and 1.
 * @param atmosphericDensity The atmospheric density, in kg/m^3.
 * @return The thrust produced by the engine.
 */
fun calculateEngineThrust(throttle: Double, atmosphericDensity: Double): Double {

    val enginePower = 5000.0  // Power output of the engine in watts
    val thrustCoefficient = 0.6  // Efficiency of the engine

    var validThrottle = throttle
    while (true) {
        if (validThrottle < 0 || validThrottle > 1) {
            println("Throttle setting must be between 0 and 1.")
            validThrottle = readLine()?.toDoubleOrNull() ?: 0.0
        } else {
            break
        }
    }

    val thrust = enginePower * thrustCoefficient * validThrottle
    val adjustedThrust = thrust / atmosphericDensity

    return adjustedThrust
}