Question

If P dollars (aka principal) is invested at 1% interest compounded annually, then the future value of the investment after n years is given by the formula Future value = P(1 + r/100) Demonstrate your ability to use C++ syntax to design and develop a program to accept the principal, interest rate and years and displayed the computed future value with 2 decimal places. Use the pow function for this computation. The loop is controlled via the sentinel value. ‘E. Include in your answer the Two include files that provides the requirements to display with 2 decimal places and the pow function poefion for this eoprovides the (15 marks)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student,

below i written the C++ code as per the requirement.

Please note the below program has been tested on ubuntu 16.04 system and compiled using g++ compiler. This code will also work on code blocks.

-----------------------------------------------------------------------------------------------------------------------------------

Program:

------------------------------------------------------------------------------------------------------------------------------------

//header files

#include<iostream>

#include<iomanip>

#include<cmath>

//namespace

using namespace std;

//start of main function

int main()

{

//setting precision to two decimal point

cout<<fixed<<setprecision(2)<<endl;

double FV, P, r;

char sentinel;


int N;

//satrt of do while loop

do
{

cout<<"Enter the principal amount: ";

cin>>P;

cout<<"Enter the interest rate: ";

cin>>r;

cout<<"Enter the yaers: ";

cin>>N;

//formual to calculate future value

FV = P * pow((1 + r/100), N);

cout<<"The future value is: "<<FV<<endl;

cin>>sentinel;

//if sentinel value is E

if(sentinel == 'E')

{

break;

}

}while(sentinel != 'E');

return 0;

}
//end of the main function


================================================================

Output:

nirmalsharma@ubuntu /HomeworkLib solutions/21_02_ 2017$ g++ future value.cpp nirmalsharma@ubuntu HomeworkLib_solutions/21_02_20175 l Ente

==================================================================

Kindly Check and Verify Thanks..!!!

Add a comment
Know the answer?
Add Answer to:
If P dollars (aka principal) is invested at 1% interest compounded annually, then the future value...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • If P dollars (aka principal) is invested at r% interest compounded annually, then the future value...

    If P dollars (aka principal) is invested at r% interest compounded annually, then the future value of the investment after n years is given by the formula Future value = P(1 + r/100)n Demonstrate your ability to use C++ syntax to design and develop a program to accept the principal, interest rate and years and displayed the computed future value with 2 decimal places. Use the pow function for this computation. The loop is controlled via the sentinel value, ‘E’....

  • Find the value, in 2 years’ time, of $4000 invested at 5% compounded annually. In the...

    Find the value, in 2 years’ time, of $4000 invested at 5% compounded annually. In the following 2 years, the interest rate is expected to rise to 8%. Find the final value of the investment at the end of the 4-year period, and find the overall percentage increase. Give your answers correct to 2 decimal places. Find the value, in 2 years’ time, of $4000 invested at 5% compounded annually. In the following 2 years, the interest rate is expected...

  • Calculate the future value of a $1 investment paying interest of 12% compounded annually. Work out...

    Calculate the future value of a $1 investment paying interest of 12% compounded annually. Work out the value of the investment after 1, 5, and 20 years. (Do not round intermediate calculations. Round your answers to 4 decimal places.)    Investment A Future value1 $ Future value5 $ Future value20 $    b. Calculate the future value of a $1 investment paying interest of 11.7% compounded semiannually. Work out the value of the investment after 1, 5, and 20 years....

  • A principal of $S1900 is invested at 6 % interest, compounded annually. How much will the...

    A principal of $S1900 is invested at 6 % interest, compounded annually. How much will the investment be worth after 7 years? Use the calculator provided and round your answer to the nearest dollar. X

  • Suppose that $100,000 is invested at 5% interest, compounded annually A = P(1 + r)' a)...

    Suppose that $100,000 is invested at 5% interest, compounded annually A = P(1 + r)' a) Find a function for the amount in the account after t years b) Find the amount of money in the account after 8 years

  • an account at an interest rate r compounded conltinuously, then the amount A (caled the future value of P) in the a...

    an account at an interest rate r compounded conltinuously, then the amount A (caled the future value of P) in the account t years from now wil be A P Solving the equation for P, we get PrAcft, In this formulation, Pis called the present value of the investment. (a) Find the present value of $400,000 at 6% compounded continuously for 25 years (b) Find the interest rate compounded continuously that is needed to have $40,000 be the present value...

  • Suppose we want to find the future value of $6,000 invested at 8.5% compounded continuously for...

    Suppose we want to find the future value of $6,000 invested at 8.5% compounded continuously for 7 years. ir mt A. Periodic Compound Interest: S = P(1+ – m / B. Continuously Compounded Interest: S = Pe” [(1 + 5)mt – 1] C. Future Value of an Ordinary Annuity: S = R || 11- D. Present Value of an Ordinary Annuity: P = R Il + 1. Choose the correct formula above for this scenario. - 2. What is the...

  • Use the model A=pe" or AFP where A is the future value of P dollars invested...

    Use the model A=pe" or AFP where A is the future value of P dollars invested at interest rate r compounded continuously or n times per year for t years. If a couple has $40,000 in a retirement account, how long will it take the money to grow to $1,000,000 if it grows by 5.5% compounded continuously? Round up to the nearest year. It will take approximately years.

  • Use the model A Peor A-P1+ where is the future value of dollars invested at interest...

    Use the model A Peor A-P1+ where is the future value of dollars invested at interest rater compounded continuously or times per year for years. If $14,000 is invested in an account earning 7.5% interest compounded continuously, determine how long it will take the money to double. Round up to the nearest year. It will take approximately 9.3 years.

  • 1. Suppose $26002600 is invested annually into an annuity that earns 55​% interest. If P dollars...

    1. Suppose $26002600 is invested annually into an annuity that earns 55​% interest. If P dollars are invested annually at an interest rate of​ r, the value of the annuity after n years is given by the following equation. Upper W equals Upper P left bracket StartFraction left parenthesis 1 plus r right parenthesis Superscript n Baseline minus 1 Over r EndFraction right bracketW=P(1+r)n−1r How much is the annuity worth after 5 years? 2. Suppose that ​$90,000 is invested at...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT