I need help on part c d and f. Question is in comments

1 view (last 30 days)
%% Part A
dollars = 50000;
inflation = .02;
startAge = 23;
endAge = 65;
for year = startAge : 1 : endAge
dollars = dollars + (dollars * .02);
end
annual401kInterest = .08;
dollarsrequired = dollars / annual401kInterest;
fileID = fopen('Retirement.txt','w');
fprintf(fileID, '%.2f\r\n ', dollars);
fprintf(fileID, '%.2f\r\n ', dollarsrequired);
%% Part B
salary = 60000;
annualRaise = 0.05;
maxContribution = 19000;
personalContribution = [0.05; 0.1; 0.15; 0.2];
companyContribution = [0.05; 0.06; 0.06; 0.06];
totalDollars = 0;
interestGenerated = [0 0 0 0];
graphableDollars = [];
years = [];
for year = startAge : 1 : startAge + 30
salary = salary + (salary * annualRaise);
personalContributions = salary + personalContribution + maxContribution;
companyMatch = salary + companyContribution + maxContribution;
yearlyContribution = personalContributions + companyMatch ;
totalDollars = totalDollars + yearlyContribution;
interestGenerated = totalDollars * annual401kInterest;
totalDollars = totalDollars + interestGenerated;
for x = 1 : length(personalContribution)
fprintf(fileID, 'age: %g\tPersonal Contribution: $%.2f\r\n', year, personalContributions(x));
fprintf(fileID, 'age: %g\tCompany Contribtuions: $%.2f\r\n', year, companyMatch(x));
fprintf(fileID, 'age: %g\tInterest Generated: $%.2f\r\n', year, interestGenerated(x));
fprintf(fileID, 'age: %g\tCurrentDollars: $%.2f\r\n', year, totalDollars(x));
fprintf(fileID, '*********************************\n');
end
graphableDollars = [graphableDollars totalDollars];
years = [years year];
end
plot(years, graphableDollars)
xaxis
for x = 1 : length(personalContribution)
fprintf(fileID, 'total dollars for %.2f interest: $%.2f\r\n', personalContribution(x), totalDollars(x));
fprintf(fileID, 'You are going to be $%.2f dollars ahead of your goal\r\n', totalDollars(x) - dollarsrequired );
end
  2 Comments
Hunter Steele
Hunter Steele on 11 Oct 2019
DO THIS PART IN ONE M FILE.
You are a new employee at a hot contractor in the
area. You’ve been given the retirement package and are now trying to figure out various
scenarios for your retirement.
We are going to step through many things to consider, and will
plot and change vario
us scenarios. First there are some baseline conditions
:
-
Your starting pay will be 60,000 dollars and are
guaranteed
a
5% raise every year.
-
Your company does a 6% matching. This means for every dollar you contribute,
they will match that amount, up unti
l 6% of your current salary.
-
The maximum contribution for the next 50 years will stay stagnant at 19000 dollar
.
This mean your personal contributions pre tax will be capped at 19000 dollars.
More than this will come out of your Post
-
Tax income.
-
The 401k i
s assumed 8% annual growth
and will never have a bad year and the stock
market never crashes.
-
Assume for this exercise you start working at 2
3
.
Your goal is to calculate the various scenarios, plot anything required, and answer any questions
as a complet
e sentence in your code.
For any questions that ask for multiple scenarios that are
similar, use matrix math to run all the calculations at once.
All plots should have a descriptive
legend and
using visible connected lines
.
All
text
outputs should be to
a file called
Retirement.txt”
and not the terminal.
Separate each part (A
F) in your output similar to
“Part A:
“with
a new line
at the end
.
Skip an extra line between each part.
A)
While working these calculations you realize that you also need to cal
culate how much
money you will need. You know that inflation is on average 2% annual. If you know that
without any bills you can comfortably live off of 50,000 dollars in current year dollars,
calculate how much money you will need in your 401k when you
retire at 65 years old.
B)
Plot the following on 1 plot with a proper legend
and state how much money you will have
saved after 30 years.
Assume that you do not clear the 19000 dollar
pre
-
tax
cap
(meaning
you will never contribute more than this in a year)
.
Run all these calculations at once (in a
matrix)
and state weather you will have enough savings from part A.
a.
You will start with
a 5% contribution to your 401k
b.
10%
personal
contribution.
c.
15% personal contribution.
d.
20% personal contribution.
C)
Its known that every 10
-
15 years the stock market takes a tumble. Assume that instead of
this, 20 years into your savings, a massive crash happens, and
you lose 35% of your total
portfolio (as in your 401k at that point drops by 35%). You know that these
things happen,
and are a natural part of the market, and you want to plan for the long game. Plot the
following scenarios and answer weather each will leave you enough savings (from your
calculations in part A)
a.
5% contribution
b.
10% personal
contribution
c.
15% personal contribution
d.
20% personal contribution
D)
You decide early on in your career that you want to follow a passion career as soon as you
can be financially sustainable. You set a goal of age 50 where you will want to stop working
and just let your 401k build naturally. How much do you have to save every year in order to make this happen?
F)
Now run the calculation 1 more time so that you hit the contribution max(the $19000)when you’re 30 years old, but assume that every 10 years your portfolio loses 15% of its value due to market corrections.

Sign in to comment.

Answers (1)

Shivam Prasad
Shivam Prasad on 15 Oct 2019
Hi Hunter,
Refer to this link to refine the question.

Categories

Find more on Historical Contests in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!