Subject:Computer SciencePrice:2.87 Bought7
How would you write the following program in Flowgorithm?
The user will enter the data of their present age. Everyone is considered to be retiring at 70 for purposes of this application. The user will also enter how much money per year they will place into the retirement plan.
With these values, the application will first calculate the value of the nest egg. The value of 3 percent per year will be used in the calculations. After calculating the nest egg, the length of time the nest egg will last needs to be calculated.
First the Nest Egg Calculation.
Each year left until the user reaches 70, they will put money into the nest egg. At the end of each year, the egg grows by 3 percent. Then the next year another deposit of money and a growth again. As this calculation is performed every year, you might be looking at some kind of loop.
Show only the amount in the nest egg at age 70, when retirement starts. You do not have to show the yearly deposits and growth.
Here is s short example. Say someone is 65 and they want to put in $1,000 each year. So they have 5 years left (65 to 70), in year 1 they deposit $1,000 and then at the end of the year they get 3% interest on that $1,000. Now they have $1,030 in saving. Year 2, another $1,000 is added bringing the total at the end of the year to $2,030 and then that gets 3% interest bring the new total to $2,090.90. From that you should be able to see how to continue for years 3 and 4 and 5. At the end of 5 years, the Total after the 3% interest of year 5 is $5.468.41. That is the starting nest egg for next phase of the program.
The next step is then to show the schedule of dispersal from the nest egg.
Starting at age 70 and continuing until the nest egg is empty (value of 0) or a maximum of 30 years, the application will show the remaining amount of the nest egg after expenses and adding in a growth of 4 percent. Each year show the age of the person along with the remaining funds.
This is the reverse process of building the nest egg. Instead of putting money in each year, you will be removing it. At the end of each year, the remaining balance will grow by 4 percent. If the value of expenses is greater than the amount left in the nest egg, empty the nest out and display a Funds Depleted message.
If at the end of 30 years, there are funds remaining, show a final balance.
During the retirement years, you will need to take out for expenses $47,250. The remaining balance after that dispersal will grow by 4 percent. This calculation will give the balance at the beginning of the next year.
If a beginning balance to a year is less than or equal to the expenses, then that year depletes the nest egg. That is the age at which you display the Funds Depleted message.
Example: If on age 76, there is only $44,000 left, the display to the user would be Age 76 - Funds Depleted.