Computer scienceProgramming languagesJavaAdditional instrumentsEssential standard classesStandard classes for computations

BigDecimal

Deposit

Report a typo

Write a program to calculate the deposit.

In the input the accepted 3 values are in the following order: starting amount of money, interest rate, and the number of years during which the deposit is accrued.

The bank increases the deposit by the specified percentages every year. This can be described with the following formula:

finalAmount=startingAmount(1+yearlyPercent100)yearsfinalAmount=startingAmount \cdot \left(1 + \frac{yearlyPercent}{100}\right)^{years}

The program should convert the entered strings to BigDecimal and calculate how much money there will be in the account after the given number years. The result should be rounded upwards, to positive infinity (CEILING mode), up to 2 (two) digits after the point.

The program should output the following string: "Amount of money in the account: <>". Instead of <> there must be the total amount of money.

It is guaranteed that all numbers are positive and the number of years is an integer.

Sample Input 1:

100000.2
20
1

Sample Output 1:

Amount of money in the account: 120000.24

Sample Input 2:

589456.67
15
5

Sample Output 2:

Amount of money in the account: 1185607.91
Write a program in Java 17
import java.math.BigDecimal;
import java.math.RoundingMode;

class Main {
public static void main(String[] args) {
// write your code here
}
}
___

Create a free account to access the full topic