Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In R: Suppose we have two investment contracts, one is Single Interest, another one is Com- pound Interest, in the formula, P is initial investment,
In R:
Suppose we have two investment contracts, one is Single Interest, another one is Com- pound Interest, in the formula, P is initial investment, r is interest rate, t is time in year), A is total amount you get after t years. A. = P +(1+r*t) Ac = P *e"c*t (a) (10 points) Write two functions called Totals and Totalc to calculate the total amount you can get after t years, your input should include P, r and t. (b) (10 points) Suppose now you have 10,000 dollars, and the single interest rate is 6% each year, the compound interest rate is 4.5% each year. If we need 15,000 dollars to buy a car, which way is faster to get 15,000? and when can you buy the car? (If you get a fraction or decimal, round to the next integer.) (c) (15 points) Write another function, compare two contracts and calculate how much more you can get after t years using the better contract, print the better way (single or compound) and the difference. Your input should include P, rs, rc and t. (d) (15 points) Suppose we fix our P, rs, rc as in (b), use curve() to plot A, and Ac in one graph. Label the x-axis as "Time, in Year" , the y-axis as "Money, in Dollar. (e) (5 points) (Bonus) Are the two curves intersect with each other? if yes, can you find the intersection point? (f) (5 points) (Bonus) Can you use ggplot2 to plot part(d)? Suppose we have two investment contracts, one is Single Interest, another one is Com- pound Interest, in the formula, P is initial investment, r is interest rate, t is time in year), A is total amount you get after t years. A. = P +(1+r*t) Ac = P *e"c*t (a) (10 points) Write two functions called Totals and Totalc to calculate the total amount you can get after t years, your input should include P, r and t. (b) (10 points) Suppose now you have 10,000 dollars, and the single interest rate is 6% each year, the compound interest rate is 4.5% each year. If we need 15,000 dollars to buy a car, which way is faster to get 15,000? and when can you buy the car? (If you get a fraction or decimal, round to the next integer.) (c) (15 points) Write another function, compare two contracts and calculate how much more you can get after t years using the better contract, print the better way (single or compound) and the difference. Your input should include P, rs, rc and t. (d) (15 points) Suppose we fix our P, rs, rc as in (b), use curve() to plot A, and Ac in one graph. Label the x-axis as "Time, in Year" , the y-axis as "Money, in Dollar. (e) (5 points) (Bonus) Are the two curves intersect with each other? if yes, can you find the intersection point? (f) (5 points) (Bonus) Can you use ggplot2 to plot part(d)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