Alice and Bob investmentCalculator

Alice and Bob want to invest same amount of money, but at different interest rates.

For Alice, her interest is a simple interest, which means she gets the same interest every year.

Her interest rate is based on the amount of money she invests at the beginning. e.g. If Alice invests $200, her interest rate is 8%. She earns 8% of the original investment (200 *0.08 = $16) every year. So, she gets $16 for the interest every year.


$1 - $99

$100 - $299

$300 - $499

$500 - 31000


Interest Rate

7% (0.07)

8% (0.08)

9% (0.09)


11% (0.11)

For Bob, he invests the same amount of money at 3% compound interest. That is, interest is 3% Of the current balance, including previous additions of interest.

e.g. Bob earns 3% of $200 at the first year ($200 *0.03 $6), giving him $206. The next year, he will earn 3% of $206 for interest, and so on.

Write a program to figure out how many years it takes for the balance of Bob's investment to exceed the balance of Alice's investment, and display the balance of both investments at that year.

1. (1 ptr) Decimals are involved, use double instead of int to declare your variables. (e.g. double aliceRate ; ) Because Bob's interest rate is fixed at 3%, declare it using const.

2. (2 pts) Ask user (Alice) to enter the original investment, Bob's investment will be set to the same amount. Check user input, if the number is less than 1, set the investment amount to $1.

Display the original investment amount for Alice and Bob.

3. (3 ptrs) Using if/ else if statement to decide what is the proper interest rate for Alice (which is based on her original investment amount.) Display the interest rate for Alice and Bob.

4. (3 ptrs) Using loops to find out how many years it takes for the balance Of Bob's investment to equal to or exceed the balance of Alice's investment.

5. (1 ptr) Display the result to the screen (the year, Alice's balance and Bob's balance at that year).

Turn in: code file (.cpp) and screenshots of sample outputs (input -1, 45, 301, 700 and 1200 separately and take screenshots of the outputs) Make sure you put your name, section number, and assignment number in comments at the beginning of your program.
Powered by