Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ function named CalculateInterestIncome to return the final amount given the original principal, the annual interest rate (percentage value like 4.3% example), the

Write a C++ function named CalculateInterestIncome to return the final amount given the original principal, the annual interest rate (percentage value like 4.3% example), the compounding frequency, the overall length of time the interest is applied. The total accumulated value, including the principal sum plus compounded interest , is given by the formula:

where:

  • A is the final amount
  • P is the original principal
  • r is the annual interest rate as the absolute value-not as a percentage
  • n is the compounding frequency
  • t is the overall length of time the interest is applied (expressed using the same time units as r, usually years).

Example:

Suppose a principal amount of $1,500 is deposited in a bank paying an annual interest rate of 4.3%, compounded quarterly. Then the balance after 6 years is found by using the formula above, with P = 1500, r = 0.043, n = 4, and t = 6:

So the amount A after 6 years is approximately $1,938.84. Note the value of r in the formula is the absolute rate not percentage rate.

Do the following:

    1. Follow the UMPIRE process and write only the plan as a code comment
    2. Write your function
      1. Document what your function does as a code comment.
      2. Must pass r, the annual interest rate as a percentage
    3. In your main program, calculate the final amount for a principal amount of $2000.00 deposited in a bank paying an annual interest rate of 3.0%, compounded monthly for keeping 10 years. image text in transcribed
// PLAN: //Follow the UMPIRE technique and write your PLAN below. Please comment out your writing. ... ... // IMPLEMENT: \#include ... \} // REVIEW: int main(int argc, char *argv[]) \{ // Print calls to your function for each data point in the order given in the problem statement. // See example below. double principal =100.; double annual rate =3.2; int frequency =12; double time =4.5; std::cout int(CalculateInterestIncome(principal, annual_rate, frequency, time)) std::endl; // Calculate the final return value for the test case given by printing int value of the call to your function, // CalculateInterestIncome. See the call above on using int(). ... ... return

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Define orientation, and explain the purposes of orientation.

Answered: 1 week ago