/**
 * This function calculates the interest amount based on the given principal, interest rate and time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Double): Double {

    // Calculate the simple interest
    val interest = principal * rate * time

    // Check if the interest is positive or negative
    val sign = if (interest >= 0) "+" else "-"

    // Calculate the absolute value of the interest
    val absoluteInterest = if (sign == "+") interest else -interest

    return absoluteInterest
}
/**
 * This function calculates the interest amount based on the given principal, interest rate and time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Double): Double {
/**
 * This function calculates the interest amount based on the given principal, interest rate and time period.
 */
fun calculateInterest(principal: Double, rate: Double, time: Double): Double {

    // Calculate the simple interest
    val interest = principal * rate * time

    // Check if the interest is positive or negative
    val sign = if (interest >= 0) "+" else "-"

    // Calculate the absolute value of the interest
    val absoluteInterest = if (sign == "+") interest else -interest

    return absoluteInterest
}