Question

In: Computer Science

Program 3: Give a baby $5,000!  Did you know that, over the last century, the stock market...

Program 3: Give a baby $5,000!  Did you know that, over the last century, the stock market has returned an average of 10%?  You may not care, but you’d better pay attention to this one.  If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)!  Don’t believe us?  Check out the compound interest calculator from MoneyChimp and plug in the numbers!

To keep things simple, we’ll calculate interest in a simple way.  You take the original amount (called the principle) and add back in a percentage rate of growth (called the interest rate) at the end of the year.  For example, if we had $1,000 as our principle and had a 10% rate of growth, the next year we would have $1,100.  The year after that, we would have $1,210 (or $1,100 plus 10% of $1,100).  However, we usually add in additional money each year which, for simplicity, is included before calculating the interest.

Your task is to design (pseudocode) and implement (source) for a program that 1) reads in the principle, additional annual money, years to grow, and interest rate from the user, and 2) print out how much money they have each year.  Task 3: think about when you earn the most money! Lesson learned: whether it’s your code or your money, save early and save often…

Sample run 1:

Enter the principle: 2000

Enter the annual addition: 300

Enter the number of years to grow: 10

Enter the interest rate as a percentage: 10

Year 0: $2000

Year 1: $2530

Year 2: $3113

Year 3: $3754.3

Year 4: $4459.73

Year 5: $5235.7

Year 6: $6089.27

Year 7: $7028.2

Year 8: $8061.02

Year 9: $9197.12

Year 10: $10446.8

Sample run 2 (yeah, that’s $9.4MM):

Enter the principle: 5000

Enter the annual addition: 1000

Enter the number of years to grow: 67

Enter the interest rate as a percentage: 10

Year 0: $5000

Year 1: $6600

Year 2: $8360

Year 3: $10296

Year 4: $12425.6

Year 5: $14768.2

.

.

Year 59: $4.41782e+06

Year 60: $4.86071e+06

Year 61: $5.34788e+06

Year 62: $5.88376e+06

Year 63: $6.47324e+06

Year 64: $7.12167e+06

Year 65: $7.83493e+06

Year 66: $8.61952e+06

Year 67: $9.48258e+06

////////////( PLEASE WRITE IN PSEUDOCODE )/////////////////

Solutions

Expert Solution

p: Principle
a: Annual addition
S: Final sum after addition of interest
y: No of years
i: Interest rage as percentage
j: it denotes calculation for jth year

Begin:
        Print input request for p
                "Enter principle:"
        Print input request for annual addition a
                "Enter annual addition:"
        Print input request for years to grow y
                "Enter the number of years to grow:"
        Print input request for interest rate i
                "Enter the interest rate as percentage:"
        Initialize j to 0
        Print sum for jth year
                "Year j:"       p
        Repeat until year number j is less than or equal to y:
                Calculate sum for jth year:
                        //Interest = (principle*interest rate* time_years)/100
                        p = principle p + interest on p + annual addition a)
                
                Print
                        "Year j:" p
        End:
End

Related Solutions

Program 3: Give a baby $5,000! Did you know that, over the last century, the stock...
Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe...
Program 3: Give a baby $5,000! Did you know that, over the last century, the stock...
Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe...
: Give a baby $5,000! Did you know that, over the last century, the stock market...
: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe us?...
Please do this in PSEUDOCODE.Give a baby $5,000! Did you know that, over the last century,...
Please do this in PSEUDOCODE.Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)!...
Please do in java Program 3: Give a baby $5,000! Did you know that, over the...
Please do in java Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement...
Did you know that there are over 500 types of bananas in the world? Did you...
Did you know that there are over 500 types of bananas in the world? Did you also know that bananas are an excellent source of potassium, fiber, and vitamin B-6 as well as serve as a powerful antioxidant? However, most people might not be aware of the prolific amount of banana consuming possibilities that are available to them. Wouldn't it be amazing if we have a program that would randomly recommend a type of banana for someone to eat every...
The stock market provided the following return over the last 3 years. Year Return 2016 +15...
The stock market provided the following return over the last 3 years. Year Return 2016 +15 2017 -30 2018 +35 What is the arithmetic average return? What is the geometric average return? Suppose you invested $1000 at the beginning of each of 2016,2017,2018 and withdrew all funds at the end of 2018, what is your average return (IRR)
events/tragedies that changed the safety movement over the last Century
events/tragedies that changed the safety movement over the last Century
events/tragedies that changed the safety movement over the last Century
events/tragedies that changed the safety movement over the last Century
What is the price of the stock of company ABC is you know this will last...
What is the price of the stock of company ABC is you know this will last for 10 years and will pay dividends for 8 years beginning at the end of year 3. The dividend will be a flat $1 pero year. The discount rate is 10%
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT