Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MUST BE IN C++ LANGUAGE. You may not use any header files other than iostream or any built-in functions.** For this assignment you are to

MUST BE IN C++ LANGUAGE. You may not use any header files other than iostream or any built-in functions.**

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 b, int e) This function returns the value computed by raising the value indicated by the first parameter b (the base) to the power indicated by the second parameter e (the exponent). The function should allow negative, positive, and zero-valued (integer) exponent values.

double PresentValue (double payamt, double intrte, int trm) where the first parameter payamt is the Payment Amount, the second parameter intrte is the Interest Rate, expressed as (i.e., normalized to) a value between 0 and 1, and the third parameter trm 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& payamt, int& trm, double& intrte) 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions