L05-rt-FOR loops-interest

DUE: BEFORE MIDNIGHT of Friday of week 6

USE a WHILE loop to do this

Ask the user for inputs needed (investment and interest rate Example 10000 and 5)

Keep the program going until the user doesn’t want to try another one. See SUBMISSION below for more info on output.

USE a FOR loop to do this calculation inside the while loop

The program that calculates the interest earned on an investment over 10 years.

If the person invested $10,000 at 5% then each year the output would state the following:

At the end of Year 1 you will have 10500.00

At the end of Year 2 you will have 11025.00

At the end of Year 3 you will have 11576.25

…..etc

At the end of Year 10 you will have 16288.95

Make sure the decimal values line up.

The calculation means you have to accumulate the principal + the interest

Calculation is à principal = principal * (1+rate)

SUBMISSION:

Run the script program

script 5.txt

cc 5.c

cat 5.c

a.out

Ron Tarr 10 year Investment Program çbut use your name

Enter the amount you want to invest: 10000

Enter the interest rate: 5

Then the program will generate output similar to what is shown in the FOR loop section

Do you another Y/N: Y

Enter the amount you want to invest: 8355

Enter the interest rate: 6.75

Then the program will generate output

Do you want another Y/N: N

exit

CUT AND PASTE the file 5.txt into an email to the instructor

IF YOU DON’T UNDERSTAND --- ASK QUESTIONS

L05-rt-FOR loops - interest by rt -- 30 January 2014 1 of 1