/**
 * Calculates the return on investment (ROI) based on the sales and expenses.
 * If the sales or expenses are negative, IllegalArgumentException is raised.
 * If the expenses are 0, ArithmeticException is raised.
 *
 * @param sales The sales amount.
 * @param expenses The expenses amount.
 * @return The calculated ROI.
 * @throws IllegalArgumentException If the sales or expenses are negative.
 * @throws ArithmeticException If the expenses are 0.
 */
fun calculateRoi(sales: Double, expenses: Double): Double {

    if (sales < 0) {
        throw IllegalArgumentException("Sales cannot be negative.")
    }

    if (expenses < 0) {
        throw IllegalArgumentException("Expenses cannot be negative.")
    }

    if (expenses == 0.0) {
        throw ArithmeticException("Expenses cannot be zero.")
    }

    return (sales - expenses) / expenses
}
/**
 * Calculates the return on investment (ROI) based on the sales and expenses.
 * If the sales or expenses are negative, IllegalArgumentException is raised.
 * If the expenses are 0, ArithmeticException is raised.
 *
 * @param sales The sales amount.
 * @param expenses The expenses amount.
 * @return The calculated ROI.
 * @throws IllegalArgumentException If the sales or expenses are negative.
 * @throws ArithmeticException If the expenses are 0.
 */
fun calculateRoi(sales: Double, expenses: Double): Double {
/**
 * Calculates the return on investment (ROI) based on the sales and expenses.
 * If the sales or expenses are negative, IllegalArgumentException is raised.
 * If the expenses are 0, ArithmeticException is raised.
 *
 * @param sales The sales amount.
 * @param expenses The expenses amount.
 * @return The calculated ROI.
 * @throws IllegalArgumentException If the sales or expenses are negative.
 * @throws ArithmeticException If the expenses are 0.
 */
fun calculateRoi(sales: Double, expenses: Double): Double {

    if (sales < 0) {
        throw IllegalArgumentException("Sales cannot be negative.")
    }

    if (expenses < 0) {
        throw IllegalArgumentException("Expenses cannot be negative.")
    }

    if (expenses == 0.0) {
        throw ArithmeticException("Expenses cannot be zero.")
    }

    return (sales - expenses) / expenses
}