/**
 * A police officer wants to update the information of their team members stored in a dictionary.
 * The dictionary contains officer IDs as keys and officer names as values. However, there is a missing
 * break statement in the code that prevents the officers from updating the dictionary successfully.
 * Find the location of the break statement and fix it to complete the task.
 *
 * @param officers A dictionary containing officer IDs as keys and officer names as values.
 * @return The updated dictionary with officer information.
 */
fun updateOfficerInfo(officers: MutableMap<Int, String>): MutableMap<Int, String> {

    while (true) {
        println("1. Add an officer")
        println("2. Update an officer's name")
        println("3. Delete an officer")
        println("4. Exit")

        val choice = readLine()!!.toInt()

        when (choice) {
            1 -> {
                print("Enter officer ID: ")
                val officerId = readLine()!!.toInt()
                print("Enter officer name: ")
                val officerName = readLine()!!
                officers[officerId] = officerName
            }
            2 -> {
                print("Enter officer ID to update: ")
                val officerId = readLine()!!.toInt()
                if (officerId in officers) {
                    print("Enter new officer name: ")
                    val officerName = readLine()!!
                    officers[officerId] = officerName
                }
            }
            3 -> {
                print("Enter officer ID to delete: ")
                val officerId = readLine()!!.toInt()
                officers.remove(officerId)
            }
            4 -> return officers
        }
    }
}
/**
 * A police officer wants to update the information of their team members stored in a dictionary.
 * The dictionary contains officer IDs as keys and officer names as values. However, there is a missing
 * break statement in the code that prevents the officers from updating the dictionary successfully.
 * Find the location of the break statement and fix it to complete the task.
 *
 * @param officers A dictionary containing officer IDs as keys and officer names as values.
 * @return The updated dictionary with officer information.
 */
fun updateOfficerInfo(officers: MutableMap<Int, String>): MutableMap<Int, String> {
/**
 * A police officer wants to update the information of their team members stored in a dictionary.
 * The dictionary contains officer IDs as keys and officer names as values. However, there is a missing
 * break statement in the code that prevents the officers from updating the dictionary successfully.
 * Find the location of the break statement and fix it to complete the task.
 *
 * @param officers A dictionary containing officer IDs as keys and officer names as values.
 * @return The updated dictionary with officer information.
 */
fun updateOfficerInfo(officers: MutableMap<Int, String>): MutableMap<Int, String> {

    while (true) {
        println("1. Add an officer")
        println("2. Update an officer's name")
        println("3. Delete an officer")
        println("4. Exit")

        val choice = readLine()!!.toInt()

        when (choice) {
            1 -> {
                print("Enter officer ID: ")
                val officerId = readLine()!!.toInt()
                print("Enter officer name: ")
                val officerName = readLine()!!
                officers[officerId] = officerName
            }
            2 -> {
                print("Enter officer ID to update: ")
                val officerId = readLine()!!.toInt()
                if (officerId in officers) {
                    print("Enter new officer name: ")
                    val officerName = readLine()!!
                    officers[officerId] = officerName
                }
            }
            3 -> {
                print("Enter officer ID to delete: ")
                val officerId = readLine()!!.toInt()
                officers.remove(officerId)
            }
            4 -> return officers
        }
    }
}