/**
 * This function calculates the total dose of a medication based on the patient's weight, dosage per kg, and number of doses needed.
 *
 * @param patientWeight weight of the patient in kilograms
 * @param dosagePerKg dosage of the medication per kilogram of patient's weight
 * @param numOfDoses number of doses needed
 * @return total dose of the medication considering the patient's weight, dosage per kg, and number of doses needed
 */
fun calculateDose(patientWeight: Double, dosagePerKg: Double, numOfDoses: Int): Double {

    try {
        // Calculate the total dose
        val totalDose = patientWeight * dosagePerKg * numOfDoses

        // Return the total dose
        return totalDose
    } catch (e: TypeCastException) {
        // Handle case where patientWeight, dosagePerKg, or numOfDoses is not a valid number
        throw IllegalArgumentException("Invalid input. Please provide valid numbers for patientWeight, dosagePerKg, and numOfDoses.")
    } catch (e: Exception) {
        // Handle any other exceptions
        throw e
    }
}
/**
 * This function calculates the total dose of a medication based on the patient's weight, dosage per kg, and number of doses needed.
 *
 * @param patientWeight weight of the patient in kilograms
 * @param dosagePerKg dosage of the medication per kilogram of patient's weight
 * @param numOfDoses number of doses needed
 * @return total dose of the medication considering the patient's weight, dosage per kg, and number of doses needed
 */
fun calculateDose(patientWeight: Double, dosagePerKg: Double, numOfDoses: Int): Double {
/**
 * This function calculates the total dose of a medication based on the patient's weight, dosage per kg, and number of doses needed.
 *
 * @param patientWeight weight of the patient in kilograms
 * @param dosagePerKg dosage of the medication per kilogram of patient's weight
 * @param numOfDoses number of doses needed
 * @return total dose of the medication considering the patient's weight, dosage per kg, and number of doses needed
 */
fun calculateDose(patientWeight: Double, dosagePerKg: Double, numOfDoses: Int): Double {

    try {
        // Calculate the total dose
        val totalDose = patientWeight * dosagePerKg * numOfDoses

        // Return the total dose
        return totalDose
    } catch (e: TypeCastException) {
        // Handle case where patientWeight, dosagePerKg, or numOfDoses is not a valid number
        throw IllegalArgumentException("Invalid input. Please provide valid numbers for patientWeight, dosagePerKg, and numOfDoses.")
    } catch (e: Exception) {
        // Handle any other exceptions
        throw e
    }
}