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

Suppose you want to deposit a certain amount of money into a saving account, and

ID: 3634588 • Letter: S

Question

Suppose you want to deposit a certain amount of money into a saving account, and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today to make that happen? You can use the following formula, which is known as the present value formula, to find out:

P= F/(1/+r)^n

The terms in the formula are:

P is the present value, or the amont that you need to deposit today.
F is the future value that you want in the account. (In this case, F is $10,000.)
r is the annual interest rate (expressed in decimal form)
n is the number of years that you plan to let the money sit in the account.

Write a program that has a function named presentValue that performs this calculation. The function should accept the future value, annual interest rate, and number of years as arguments. It should return the present value, which is the amount that you need to deposit today. Demonstrate the function in a program that lets the user experiment with different values for the formula’s terms.

Explanation / Answer

Dear,

Here is the code

//Header file section

#include<iostream>

#include<cmath>

using namespace std;

//function prototype

float presentValue(float F,float r, float n);

void main()

{

     float F,n; //F Future value, n number of years

     float r; //annual interest rate

    //inputting values from user

     cout<<"Enter Future value:";

     cin>>F;

     cout<<"Enter annual interst rate:";

     cin>>r;

     cout<<"Enter number of years:";

     cin>>n;

      //function call

     float p= presentValue(F,r,n);

     cout<< p;

     //pause system for a while

     system("pause");

}//end main

//function definition

float presentValue(float F,float r, float n)

{

     float p;

     p= F/ (pow((1+r),n));

     return p;

} //end presentValue

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