Question: MUST BE CODED IN C++ Problem A: Investment (20 points) Pretend you have some money (ha!) that you want to invest in the stock market.

MUST BE CODED IN C++

Problem A: Investment (20 points)

Pretend you have some money (ha!) that you want to invest in the stock market. Ask the user for:

1.The initial investment

2.Yearly estimated market growth

3.How much (if any) you wish to withdraw from the account per year

4.The desired level of money you wish to get

The growth formula per year is simply:

MUST BE CODED IN C++ Problem A: Investment (20 points) Pretend you

Assume you withdraw money from the account after it grows (you cannot withdraw more than the account has!). Find out how long it takes to reach the desired amount of money (if it is reachable at all). If the account hits zero money, stop and tell them all the data.

Example 1 (user input is underlined):

Initial investment? 1000

Yearly growth rate? 0.1

Yearly withdraw amount? 50

Desired balance? 1000000

Years: 80

Balance at end: 1.0247e+06

Amount withdrawn over period: 4000

Example 2 (user input is underlined):

Initial investment? 1000

Yearly growth rate? 0.1

Yearly withdraw amount? 0

Desired balance? 1000000

Years: 73

Balance at end: 1.05115e+06

Amount withdrawn over period: 0

Example 3 (user input is underlined):

Initial investment? 100

Yearly growth rate? 0.1

Yearly withdraw amount? 99999999

Desired balance? 1000000

Years: 1

Balance at end: 0

Amount withdrawn over period: 110

Example 4 (user input is underlined):

Initial investment? 1000

Yearly growth rate? -0.1

Yearly withdraw amount? 20

Desired balance? 1000000

Years: 18

Balance at end: 0

Amount withdrawn over period: 340.114

Example 5 (user input is underlined):

Initial investment? 5000

Yearly growth rate? 0.16

Yearly withdraw amount? 0

Desired balance? 1000000

Years: 36

Balance at end: 1.04582e+06

Amount withdrawn over period: 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!