/**
 * Given a floating-point number and a decimal place value,
 * round the number to the specified decimal places
 * without utilizing the ternary operator.
 *
 * @param number The floating-point number to be rounded.
 * @param decimalPlaces The number of decimal places to round to.
 * @return The rounded number.
 *
 * Example:
 * roundDecimal(3.14159, 3)
 * Output: 3.142
 */
fun roundDecimal(number: Double, decimalPlaces: Int): Double {

    // Multiply the number by 10 raised to the power of decimalPlaces
    // to shift the desired decimal place to the one's position
    var modifiedNumber = number * Math.pow(10.0, decimalPlaces.toDouble())

    // Add 0.5 to the modified number to ensure rounding to the nearest number
    modifiedNumber += 0.5

    // Extract the integer value from the modified number
    val integerPart = modifiedNumber.toInt()

    // Divide the integerPart by 10 raised to the power of decimalPlaces
    // to shift the one's position back to the original decimal place
    val roundedNumber = integerPart / Math.pow(10.0, decimalPlaces.toDouble())

    return roundedNumber
}
/**
 * Given a floating-point number and a decimal place value,
 * round the number to the specified decimal places
 * without utilizing the ternary operator.
 *
 * @param number The floating-point number to be rounded.
 * @param decimalPlaces The number of decimal places to round to.
 * @return The rounded number.
 *
 * Example:
 * roundDecimal(3.14159, 3)
 * Output: 3.142
 */
fun roundDecimal(number: Double, decimalPlaces: Int): Double {
/**
 * Given a floating-point number and a decimal place value,
 * round the number to the specified decimal places
 * without utilizing the ternary operator.
 *
 * @param number The floating-point number to be rounded.
 * @param decimalPlaces The number of decimal places to round to.
 * @return The rounded number.
 *
 * Example:
 * roundDecimal(3.14159, 3)
 * Output: 3.142
 */
fun roundDecimal(number: Double, decimalPlaces: Int): Double {

    // Multiply the number by 10 raised to the power of decimalPlaces
    // to shift the desired decimal place to the one's position
    var modifiedNumber = number * Math.pow(10.0, decimalPlaces.toDouble())

    // Add 0.5 to the modified number to ensure rounding to the nearest number
    modifiedNumber += 0.5

    // Extract the integer value from the modified number
    val integerPart = modifiedNumber.toInt()

    // Divide the integerPart by 10 raised to the power of decimalPlaces
    // to shift the one's position back to the original decimal place
    val roundedNumber = integerPart / Math.pow(10.0, decimalPlaces.toDouble())

    return roundedNumber
}