Question

new file, invest.cpp 2. Prompt and read in the initial investment (type integer). 3. Prompt and read in the interest rate (ty
solution:
bash-4.2$ ./invest solution.exe Enter initial investment (dollars): 1000 Enter interest rate per year (percentage): 1.2 Enter
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int ii;
float r,fi,y,profit,cc,temp;
cout<<"Enter initial investment (dollars):";
cin>>ii;
cout<<"Enter interest rate per year (percentage):";
cin>>r;
cout<<"Enter number of year:";
cin>>y;
fi=ii*pow((1+(r/100)),y);
cout<<"Value of your investment compound annually after "<<fi<<" dollars."<<endl;
cout<<"profit from your investment after "<<y<<" year is "<<fi-ii<<" dollars."<<endl;
temp = (r/100)*y;
cc=ii*pow(2.71828,temp);
cout<<"Value of your investment continuously compounded after "<<y<<" year(s) is "<<cc<<" dollars."<<endl;
cout<<"profit from your investment after "<<y<<" year is "<<cc-ii<<" dollars."<<endl;
cout<<"The difference between both investment types is "<<cc-ii<<" dollars.";
}

Output :--

Enter initial investment (dollars):1000
Enter interest rate per year (percentage):1.2
Enter number of year:2
Value of your investment compound annually after 1024.14 dollars.
profit from your investment after 2 year is 24.1439 dollars.
Value of your investment continuously compounded after 2 year(s) is 1024.29 dollars.
profit from your investment after 2 year is 24.2903 dollars.
The difference between both investment types is 24.2903 dollars.

-ox C:\c++\code\invest.exe Enter initial investment (dollars): 1000 Enter interest rate per year (percentage): 1.2 Enter numb

Add a comment
Know the answer?
Add Answer to:
solution: new file, invest.cpp 2. Prompt and read in the initial investment (type integer). 3. Prompt...
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
  • Question 6: (4 points) You make a one-off initial investment of $3,500 in a bank account...

    Question 6: (4 points) You make a one-off initial investment of $3,500 in a bank account that pays 4% interest per year, with interest compounded 2 times per year. What is the value of the investment after 3 years to the nearest cent? Value after 3 years = $_ (to the nearest cent) How long will it take for the value of the investment to double (in years)? Duration for value of investment to double = (in years, to 2...

  • Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from...

    Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from a principal using simple or compound interest. First, get a principal amount from the user. Next, ask the user if simple or compound interest should be used. If the user types in anything other than these options, ask again until a correct option is chosen. Ask the user to type in the interest rate as a percentage from 0 to 100%. Finally, ask the...

  • ​​​​​​This program will make Maze game. Please Help in c++ Prompt the user for a file...

    ​​​​​​This program will make Maze game. Please Help in c++ Prompt the user for a file that contains the maze. Read it into a two-dimensional array Remember you can use inputStream.get(c) to read the next character from the inputStream. This will read whitespace and non-whitespace characters Don’t forget to read the newline character at the end of each line Print the maze to the screen from your array You should include a ‘*’ in your maze to indicate where the...

  • please type out if possible easier to read 4. Because of a chronic water shortage in...

    please type out if possible easier to read 4. Because of a chronic water shortage in California, new athletic fields must use artificial turf or xeriscape landscaping. If the value of the water saved each six-months is $5,500, how much can a private developer afford to spend now on artificial turf provided he must recover his investment in 5 years. Use an interest rate of 10% per year, compounded continuously?

  • An investment with an initial deposit of $2,654 is growing at an interest rate of 7.23%...

    An investment with an initial deposit of $2,654 is growing at an interest rate of 7.23% compounded semi- annually. Round all answers to two decimal places if necessary. 1. Find the accumulated amount of the investment at the end of 3 years. P/Y - C/Y - N = 1/Y - PV = $ PMT= $ FV - $ 2. The interest rate changes to 4.16% compounded quarterly after the first 3 years. Calculate the accumulated amount in this investment at...

  • Write a program that prints the accumulated value of an initial investment invested at a specified...

    Write a program that prints the accumulated value of an initial investment invested at a specified annual interest and compounded annually for a specified number of years. Annual compounding means that the entire annual interest is added at the end of a year to the invested amount. The new accumulated amount then earns interest, and so forth. If the accumulated amount at the start of a year is acc_amount, then at the end of one year the accumulated amount is:...

  • Quad Enterprises is considering a new three-year expansion project that requires an initial fixed asset investment...

    Quad Enterprises is considering a new three-year expansion project that requires an initial fixed asset investment of $2.82 million. The fixed asset will be depreciated straight-line to zero over its three-year tax life, after which time it will be worthless. The project is estimated to generate $2,120,000 in annual sales, with costs of $815,000. The project requires an initial investment in net working capital of $340,000, and the fixed asset will have a market value of $230,000 at the end...

  • 1. Let S(t) be the value of an investment at time t and let r be...

    1. Let S(t) be the value of an investment at time t and let r be the annual interest rate, with interest being compounded after every time interval At. Let k be the annual deposit which has an installment made after each time interval At. Then, the value of the investment at time t + At, i.e. S(t + At), is given by: S(t + At) = S(t) + (rAt)S(t) + kAt Amount at the end of time t Interest...

  • Yankay Specialty Metals Corporation is reviewing an investment proposal. The initial cost as well as the...

    Yankay Specialty Metals Corporation is reviewing an investment proposal. The initial cost as well as the estimate of the book value of the investment at the end of each year, the net after-tax cash flows for each year, and the net income for each year are presented in the following schedule. The salvage value of the investment at the end of each year is equal to its book value. There would be no salvage value at the end of the...

  • How long will it take for an investment of $2000 to double in value if the...

    How long will it take for an investment of $2000 to double in value if the interest rate is 8.5% per year, compounded continuously? (Round your answer to two decimal places.) yr (b) A 15-g sample of radioactive iodine decays in such a way that the mass remaining after t days is given by m(t) = 15e−0.077t, where m(t) is measured in grams. After how many days is there only 1 g remaining? (Round your answer to the nearest whole...

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
ADVERTISEMENT