Question: Problem 5 ( Saving Account ) ) Suppose that you put $ 1 0 0 into a savings account every month and don t withdraw

Problem 5(
Saving Account)
)
Suppose that you put
$
100 into a savings account every month and dont withdraw any
pennies from it. If the annual interest rate of saving is 5%, then we can derive monthly
saving interest rate equal to 0
.
05
/
12=0
.
00417.
After first month, your saving account has
$100
(1+0
.
00417)= $100
.
417
After second month, your saving account has
($100+ $100
.
417)
(1+0
.
00417)= $201
.
252
After third month, your saving account has
($100+201
.
252)
(1+0
.
00417)= $302
.
507
...
After k-th month, your saving account has
$100+
The amout of
(
k
1)
th
month
(1+0
.
0041)
Write a program name
compound
value.cpp
that reads from command-line arguments
three values:
A
(float),
I
(float), and
M
(int). In which,
A
represents amount of money that
you put in saving account every month;
I
represents annual interest rate for saving account,
and
M
reprensents number of months. Compute and display the amount of money you saved
after
M
months.
Your program must report error message
"Invalid amount of money!"
if
A
0 and
display the message
"Invalid number of months!"
if
M
0.
Here are sample outputs when running the program from a terminal:
/workspace/csc117/hw6
$
g++-o src/compound_value.out out/compound_value.cpp
$
./out/compound_value.out 1005.05
4
After 5 months , saved money=
$
506.285
$
./out/compound_value.out 1005.010
After 10 months , saved money =
$
1023.21
$
./out/compound_value.out 4004.524
After 24 months , saved money =
$
10063

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!