/**
 * Calculates the maximum load that a structure can handle.
 *
 * @param designLimit The maximum allowable load specified in the design code.
 * @param materialStrength The ultimate strength of the material used in the structure.
 * @param safetyFactor The safety factor used to account for uncertainties in loads and materials.
 * @return The maximum load that the structure can handle.
 */
fun calculateMaxLoad(designLimit: Float, materialStrength: Float, safetyFactor: Float): Float {

    var maxLoad = 0f
    
    for (i in 0..designLimit.toInt()) {
        val load = i * materialStrength
        
        if (load >= designLimit * safetyFactor) {
            break
        }

        maxLoad = load
    }
    
    return maxLoad
}
/**
 * Calculates the maximum load that a structure can handle.
 *
 * @param designLimit The maximum allowable load specified in the design code.
 * @param materialStrength The ultimate strength of the material used in the structure.
 * @param safetyFactor The safety factor used to account for uncertainties in loads and materials.
 * @return The maximum load that the structure can handle.
 */
fun calculateMaxLoad(designLimit: Float, materialStrength: Float, safetyFactor: Float): Float {
/**
 * Calculates the maximum load that a structure can handle.
 *
 * @param designLimit The maximum allowable load specified in the design code.
 * @param materialStrength The ultimate strength of the material used in the structure.
 * @param safetyFactor The safety factor used to account for uncertainties in loads and materials.
 * @return The maximum load that the structure can handle.
 */
fun calculateMaxLoad(designLimit: Float, materialStrength: Float, safetyFactor: Float): Float {

    var maxLoad = 0f
    
    for (i in 0..designLimit.toInt()) {
        val load = i * materialStrength
        
        if (load >= designLimit * safetyFactor) {
            break
        }

        maxLoad = load
    }
    
    return maxLoad
}