In this task, you will simulate a savings account. In a savings account you receive interest every year, depending on the amount of money in your account and the interest rate. Special about this task, however, is that this interest rate can also be negative, that is, you lose money by leaving it in your savings account.
Write a program that reads in a starting capital, the interest rate (negative or positive) and a number of years to simulate. Then show the new savings account balance by year, followed by a summary of the total profit or loss.
double
in the interval [-1,1]. For example, an interest rate of 0.04 represents 4% profit per year; an interest rate of -0.02 represents 2% loss per year.Below is a sample output of the task. The text in red represents user input and is logically not printed out by your program.
1000.0 0.05 5 Bedrag na 1 jaar: €1050.00. Bedrag na 2 jaar: €1102.50. Bedrag na 3 jaar: €1157.63. Bedrag na 4 jaar: €1215.51. Bedrag na 5 jaar: €1276.28. Na 5 jaar bedraagt de winst €276.28.
1000.0 -0.01 5 Bedrag na 1 jaar: €990.00. Bedrag na 2 jaar: €980.10. Bedrag na 3 jaar: €970.30. Bedrag na 4 jaar: €960.60. Bedrag na 5 jaar: €950.99. Na 5 jaar bedraagt het verlies €49.01.