Question
This must be a C++ language program. For this assignment you are to implement a program that computes the present value of a series of
This must be a C++ language program. For this assignment you are to implement a program that computes the present value of a series of fixed annual payments over a specified number of years, based on a specified interest rate.
Your implementation should include the use of the following two functions with the indicated prototypes.
double Power (double, int) This function returns the value computed by raising the value indicated by the first parameter (the base) to the power indicated by the second parameter (the exponent). The function should allow negative, positive, and zero-valued (integer) exponent values.
double PresentValue (double, double, int) where the first parameter is the Payment Amount, the second parameter is the Interest Rate, expressed as (i.e., normalized to) a value between 0 and 1, and the third parameter is the Term over which the payments are to be made. The function returns the present value computed using the formula:
present value = payment amount * (1-(1+interest)^-term)
______________
interest
For example, the present value for an annual payment of $10,000 for 10 years at an interest rate of 5% is $77,217.35.
void ReadData (double&, int&, double&) This function is used to prompt for and obtain from the user data to be used for computing a present value. The data consists of 3 values as follows.
Payment Amount - The amount, in dollars and cents, paid out each year.
Term - The whole number of years in which payments are made.
Interest Rate - The interest rate expressed as a real number between 0 and 100 for which the present value will be computed.
The data for the payment amount, term and interest rate are passed back to the calling program using the three respective parameters.
You may include additional functions in your program, but the functions listed above should perform only the tasks that are stated in the specifications, and they should be used for performing those tasks. For example, a function should only be used for the inputting or outputting of data if doing so is part of its specification.
Using the functions specified above, your program should repeatedly ask the user if there is data to be input. Each time the user responds in the affirmative, the program should prompt for and read the data (using the ReadData() function) needed to compute a present value, and then output the computed present value. A negative response should cause the program to terminate.
All prompts and other outputs from your program should be presented in a user-friendly way.
You may not use any header files other than iostream or any built-in functions.
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