Question
PROGRAMMING LANGUAGE C New Programming Techniques for Chapter 3 You are now allowed to use the following in additional to the techniques of the previous
PROGRAMMING LANGUAGE C
New Programming Techniques for Chapter 3
You are now allowed to use the following in additional to the techniques of the previous chapters:
ifelse
Nested ifelse
While loops (Counter and Sentinel controlled)
Float data types, casting, and formatted float printing
Increment and Decrement operators
Q4: (The Rule of 72) (25 points) The "Rule of 72" is a mental math technique that can approximate how many years it will take an investment to double given a fixed annual rate of interest. To calculate approximately how long an investment will double in amount, divide 72 by the annual interest rate for the investment. The number 72 is chosen because it is somewhat accurate for lower interest rates of return, and the number 72 is easily divided by interest rate values of 3%, 6%, 9%, and 12%.
So, for example, if I invest $10,000 in savings account and can earn 6% interest every year, it will take 12 years for the money to double (72 / 6% = 12 years). If the money is left in the account and the interest rate stays the same, my $10,000 would become $20,000 12 years, $40,000 in 24 years, $80,000 in 36 years, and $160,000 in 48 years using the Rule of 72 for approximate calculations.
A better approximation, without using actual investment formulas that require exponents (Chapter 4 in textbook) is to use the number 69.3, but this makes it now very difficult to do simple mental math approximations without the aid of a calculator. Using this number, the investment will double in 11.55 years (69.3 / 6% = 11.55 years).
Design a program that accept an investment amount, an annual interest rate, and tell me how many years it will take for that investment to double using the Rule of 72. Also show how many years it will take for it to double using the value 69.3 for a more accurate answer. Use floats for your data types.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started