/**
 * Given a map representing a police officer's details and two badge numbers,
 * change the badge number of the police officer from the old badge number to the new badge number.
 *
 * @param policeOfficer A map containing the police officer's details, with the badge number as key 'badge_number'.
 * @param oldBadgeNumber The old badge number to change.
 * @param newBadgeNumber The new badge number to replace the old badge number.
 * @return The updated map with the badge number changed.
 */
fun changeIndex(policeOfficer: MutableMap<String, Any>, oldBadgeNumber: Int, newBadgeNumber: Int): MutableMap<String, Any> {

    // Check if the old badge number exists in the map
    if (policeOfficer.containsKey("badge_number") && policeOfficer["badge_number"] == oldBadgeNumber) {
        policeOfficer["badge_number"] = newBadgeNumber  // Change the badge number
    }
    return policeOfficer  // Return the updated map
}

// Exercise Usage
/**
 * Given a map representing a police officer's details and two badge numbers,
 * change the badge number of the police officer from the old badge number to the new badge number.
 *
 * @param policeOfficer A map containing the police officer's details, with the badge number as key 'badge_number'.
 * @param oldBadgeNumber The old badge number to change.
 * @param newBadgeNumber The new badge number to replace the old badge number.
 * @return The updated map with the badge number changed.
 */
fun changeIndex(policeOfficer: MutableMap<String, Any>, oldBadgeNumber: Int, newBadgeNumber: Int): MutableMap<String, Any> {
/**
 * Given a map representing a police officer's details and two badge numbers,
 * change the badge number of the police officer from the old badge number to the new badge number.
 *
 * @param policeOfficer A map containing the police officer's details, with the badge number as key 'badge_number'.
 * @param oldBadgeNumber The old badge number to change.
 * @param newBadgeNumber The new badge number to replace the old badge number.
 * @return The updated map with the badge number changed.
 */
fun changeIndex(policeOfficer: MutableMap<String, Any>, oldBadgeNumber: Int, newBadgeNumber: Int): MutableMap<String, Any> {

    // Check if the old badge number exists in the map
    if (policeOfficer.containsKey("badge_number") && policeOfficer["badge_number"] == oldBadgeNumber) {
        policeOfficer["badge_number"] = newBadgeNumber  // Change the badge number
    }
    return policeOfficer  // Return the updated map
}

// Exercise Usage