Exercise 2: The following formula calculates the periodic payment based on the principal P, the periodic interest rate R
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Exercise 2: The following formula calculates the periodic payment based on the principal P, the periodic interest rate R
Exercise 2: The following formula calculates the periodic payment based on the principal P, the periodic interest rate R, and the number of periods N respectively. PR Payment = 1-(1+R)-N Write a complete CH program that reads P, R, and N from a text (xyz.txt) file as shown, compute the payment for each line and write the results back to another file called payments.txt as shown below: +* xyz.txt payments.txt 15000 0.08 5 P R N Payment 16500 0.095 4 15000 0.08 5 14600 0.10 6 16500 0.095 4 14600 0.10 6 E. BBS . RE
5 4 6 5 475 76 54 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 15000 16500 14600 0.08 0.095 0.10 0.082 0.095 0.70 0.08 0.095 0.20 0.08 0.095 0.10 0.082 0.095 0.70 0.08 0.095 0.20 0.08 0.095 0.10 0.082 0.095 0.70 0.08 0.095 0.20 4 6 5 4 7 5 7 6 5 4 6 5 4 7 5 7 6