/**
 * This function calculates the profit for a farmer based on the harvested crops and total expenses.
 *
 * @param crops the amount of crops harvested (in KG)
 * @param totalExpenses the total expenses incurred by the farmer
 * @return the calculated profit for the farmer
 */
fun calculateProfit(crops: Int, totalExpenses: Int): Int {

    // If the harvested crops are less than or equal to 0, set profit to 0
    val profit: Int = if (crops <= 0) {
        0
    } else {
        // Add the total expenses to the harvested crops and store it in totalIncome
        val totalIncome = crops + totalExpenses

        // If the total income is greater than 10000, set profit to totalIncome minus 2000
        if (totalIncome > 10000) {
            totalIncome - 2000
        } else {
            // If the total income is less than or equal to 10000, set profit to totalIncome minus 1000
            totalIncome - 1000
        }
    }

    return profit
}
/**
 * This function calculates the profit for a farmer based on the harvested crops and total expenses.
 *
 * @param crops the amount of crops harvested (in KG)
 * @param totalExpenses the total expenses incurred by the farmer
 * @return the calculated profit for the farmer
 */
fun calculateProfit(crops: Int, totalExpenses: Int): Int {
/**
 * This function calculates the profit for a farmer based on the harvested crops and total expenses.
 *
 * @param crops the amount of crops harvested (in KG)
 * @param totalExpenses the total expenses incurred by the farmer
 * @return the calculated profit for the farmer
 */
fun calculateProfit(crops: Int, totalExpenses: Int): Int {

    // If the harvested crops are less than or equal to 0, set profit to 0
    val profit: Int = if (crops <= 0) {
        0
    } else {
        // Add the total expenses to the harvested crops and store it in totalIncome
        val totalIncome = crops + totalExpenses

        // If the total income is greater than 10000, set profit to totalIncome minus 2000
        if (totalIncome > 10000) {
            totalIncome - 2000
        } else {
            // If the total income is less than or equal to 10000, set profit to totalIncome minus 1000
            totalIncome - 1000
        }
    }

    return profit
}