/**
 * This function calculates the bill for an electrician based on the duration of work, wire length used, and voltage.
 */
fun calculateBill(duration: Int, wireLength: Int, voltage: String): Any {

    return when {
        duration <= 2 -> {
            when {
                wireLength <= 100 -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 0.8
                        "medium" -> duration * wireLength * 1.2
                        "high" -> duration * wireLength * 1.5
                        else -> "Invalid voltage input."
                    }
                }
                wireLength <= 200 -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 0.9
                        "medium" -> duration * wireLength * 1.3
                        "high" -> duration * wireLength * 1.6
                        else -> "Invalid voltage input."
                    }
                }
                else -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 1.0
                        "medium" -> duration * wireLength * 1.4
                        "high" -> duration * wireLength * 1.7
                        else -> "Invalid voltage input."
                    }
                }
            }
        }
        else -> {
            "Duration exceeds limit for calculation."
        }
    }
}
/**
 * This function calculates the bill for an electrician based on the duration of work, wire length used, and voltage.
 */
fun calculateBill(duration: Int, wireLength: Int, voltage: String): Any {
/**
 * This function calculates the bill for an electrician based on the duration of work, wire length used, and voltage.
 */
fun calculateBill(duration: Int, wireLength: Int, voltage: String): Any {

    return when {
        duration <= 2 -> {
            when {
                wireLength <= 100 -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 0.8
                        "medium" -> duration * wireLength * 1.2
                        "high" -> duration * wireLength * 1.5
                        else -> "Invalid voltage input."
                    }
                }
                wireLength <= 200 -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 0.9
                        "medium" -> duration * wireLength * 1.3
                        "high" -> duration * wireLength * 1.6
                        else -> "Invalid voltage input."
                    }
                }
                else -> {
                    when (voltage) {
                        "low" -> duration * wireLength * 1.0
                        "medium" -> duration * wireLength * 1.4
                        "high" -> duration * wireLength * 1.7
                        else -> "Invalid voltage input."
                    }
                }
            }
        }
        else -> {
            "Duration exceeds limit for calculation."
        }
    }
}