/**
 * This function calculates the total cost of purchasing multiple items.
 *
 * @param numItems The number of items to purchase.
 * @param prices A list of prices (in dollars) for each item.
 * @return The total cost of purchasing the items.
 * @throws IllegalArgumentException If the number of items is less than or equal to 0 or if any price is negative.
 */
fun calculateCost(numItems: Int, prices: List<Double>): Double {

    var totalCost = 0.0

    if (numItems <= 0) {
        throw IllegalArgumentException("Number of items should be greater than 0.")
    }

    for (price in prices) {
        if (price < 0) {
            throw IllegalArgumentException("Price cannot be negative.")
        }

        totalCost += price
    }

    return totalCost
}
/**
 * This function calculates the total cost of purchasing multiple items.
 *
 * @param numItems The number of items to purchase.
 * @param prices A list of prices (in dollars) for each item.
 * @return The total cost of purchasing the items.
 * @throws IllegalArgumentException If the number of items is less than or equal to 0 or if any price is negative.
 */
fun calculateCost(numItems: Int, prices: List<Double>): Double {
/**
 * This function calculates the total cost of purchasing multiple items.
 *
 * @param numItems The number of items to purchase.
 * @param prices A list of prices (in dollars) for each item.
 * @return The total cost of purchasing the items.
 * @throws IllegalArgumentException If the number of items is less than or equal to 0 or if any price is negative.
 */
fun calculateCost(numItems: Int, prices: List<Double>): Double {

    var totalCost = 0.0

    if (numItems <= 0) {
        throw IllegalArgumentException("Number of items should be greater than 0.")
    }

    for (price in prices) {
        if (price < 0) {
            throw IllegalArgumentException("Price cannot be negative.")
        }

        totalCost += price
    }

    return totalCost
}