Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The rule says that to find the number of years required to double your money at

ID: 3635147 • Letter: T

Question

The rule says that to find the number of years required to double your money at a given interest rate, your just divide the interest rate into 72. For example, if you want to know how long it will take to double your money at eight percent interest, divide 8 into 72 and get 9 years. Write a JAVA program to calculate the number of years required to double your money for rates from 1 to 10%, using Rule of 72 and the actual formula to calculate compounded interest. F = P(1 + r.100)n Where F = Future value P = Present value r = Interest rate n = years Prepare a flowchart which shows your algorithm. Then write your program. You results should be displayed in the following tabular from.

Explanation / Answer

You'll need to import the math library to do this one.  Create a function to get the rule of 72 answer and one for the actual number.

To get N out  you use: N = ln(2) / ln(1 + (I/100))

 

double RuleSeventyTwo(int rate)

{

return 72 / rate;

}

double CompoundInterest(int rate)

{

return (Math.log(2) / math.log (1 + (rate/100)));

}

 

Finally you create a loop in your main method that iterates from 1-10 and spits out the answers.  Format your ouput statement to get it in the table look you need.

for (int i = 1; i <=10; i++)

{

System.out.print(i + " " + RuleSeventyTwo(i) + " " + CompoundInterest(i);

}

 

Best of luck.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote