/**
 * This exercise is designed for physical therapists to practice using else statements and nested for loops.
 * It involves monitoring a patient's progress during a rehabilitation program for a given number of iterations.
 * The therapist needs to assess the patient's range of motion (ROM) on different joints and provide feedback.
 * The exercise is quite challenging and tests your ability to handle complex control flow in Kotlin.
 *
 * @param patientName The name of the patient.
 * @param numIterations The number of iterations to monitor the patient's progress.
 */
fun exercise(patientName: String, numIterations: Int) {

    // Define a list of joints to assess
    val joints = listOf("knee", "shoulder", "elbow", "hip", "ankle")

    // Initialize an empty map to store patient's ROM for each joint
    val patientRom = mutableMapOf<String, Double>()

    // Start monitoring the patient's progress
    println("Monitoring $patientName's progress...\n")
    for (i in 1..numIterations) {
        println("Iteration $i:")

        // Prompt the therapist to measure ROM for each joint and update the map
        for (joint in joints) {
            print("Enter ROM for $joint: ")
            val measurement = readLine()?.toDoubleOrNull() ?: 0.0
            patientRom[joint] = measurement
        }
    }
}
/**
 * This exercise is designed for physical therapists to practice using else statements and nested for loops.
 * It involves monitoring a patient's progress during a rehabilitation program for a given number of iterations.
 * The therapist needs to assess the patient's range of motion (ROM) on different joints and provide feedback.
 * The exercise is quite challenging and tests your ability to handle complex control flow in Kotlin.
 *
 * @param patientName The name of the patient.
 * @param numIterations The number of iterations to monitor the patient's progress.
 */
fun exercise(patientName: String, numIterations: Int) {
/**
 * This exercise is designed for physical therapists to practice using else statements and nested for loops.
 * It involves monitoring a patient's progress during a rehabilitation program for a given number of iterations.
 * The therapist needs to assess the patient's range of motion (ROM) on different joints and provide feedback.
 * The exercise is quite challenging and tests your ability to handle complex control flow in Kotlin.
 *
 * @param patientName The name of the patient.
 * @param numIterations The number of iterations to monitor the patient's progress.
 */
fun exercise(patientName: String, numIterations: Int) {

    // Define a list of joints to assess
    val joints = listOf("knee", "shoulder", "elbow", "hip", "ankle")

    // Initialize an empty map to store patient's ROM for each joint
    val patientRom = mutableMapOf<String, Double>()

    // Start monitoring the patient's progress
    println("Monitoring $patientName's progress...\n")
    for (i in 1..numIterations) {
        println("Iteration $i:")

        // Prompt the therapist to measure ROM for each joint and update the map
        for (joint in joints) {
            print("Enter ROM for $joint: ")
            val measurement = readLine()?.toDoubleOrNull() ?: 0.0
            patientRom[joint] = measurement
        }
    }
}