/**
 * Calculate the compound interest given the principal, interest rate, and time.
 *
 * @param principal The initial investment amount.
 * @param rate The annual interest rate as a decimal.
 * @param time The time period in years.
 * @return The compound interest after the specified time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Int): Double {

    // Calculate the compound interest using the formula: principal * ((1 + rate) pow time)
    val interest = principal * Math.pow((1 + rate), time.toDouble())

    // Determine the total interest as the difference between the compound interest and the principal
    val totalInterest = interest - principal

    // Check if the total interest is greater than a certain threshold
    if (totalInterest > 5000 || rate > 0.1) {
        // Display a warning message
        println("Caution: High interest or risk!")
    } else if (totalInterest > 0) {
        // Perform additional actions if needed
    }

    return totalInterest
}
/**
 * Calculate the compound interest given the principal, interest rate, and time.
 *
 * @param principal The initial investment amount.
 * @param rate The annual interest rate as a decimal.
 * @param time The time period in years.
 * @return The compound interest after the specified time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Int): Double {
/**
 * Calculate the compound interest given the principal, interest rate, and time.
 *
 * @param principal The initial investment amount.
 * @param rate The annual interest rate as a decimal.
 * @param time The time period in years.
 * @return The compound interest after the specified time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Int): Double {

    // Calculate the compound interest using the formula: principal * ((1 + rate) pow time)
    val interest = principal * Math.pow((1 + rate), time.toDouble())

    // Determine the total interest as the difference between the compound interest and the principal
    val totalInterest = interest - principal

    // Check if the total interest is greater than a certain threshold
    if (totalInterest > 5000 || rate > 0.1) {
        // Display a warning message
        println("Caution: High interest or risk!")
    } else if (totalInterest > 0) {
        // Perform additional actions if needed
    }

    return totalInterest
}