Create a script to calculate the amount of savings for a given starting salary a
ID: 3552247 • Letter: C
Question
Create a script to calculate the amount of savings for a given starting salary and number of years. This financial calculator may be used to predict the amount of savings you will have after a fixed time period for the given assumptions.
How much will I have saved after a given amount of time (user input in years)? We start with $50K and monthly wage after tax= $2700. (Monthly) Rent=$800; utilities=$300; insurance=$200; auto=$250; food_misc=$325. Rent increases $200 every five years (increasing for the first time in month 61), and taxes increase 2% every year (for the first time in month 13).
Explanation / Answer
clc;
clear;
close all;
%% Input
prompt='give amount of time (user input in years): ';
time=input(prompt);
%% Expenses
monthlyWageAfterTaxes=2700;
rent=800;
utilities=300;
insurance=200;
auto=250;
food_misc=325;
savings=50000; % %Roughly $50K starting
total_month=time*12;
month=0;
while(month<=total_month)
savings=savings+monthlyWageAfterTaxes;
savings=savings-(utilities+insurance+auto+food_misc+rent);
i=mod(month,60);
if(i==0 && month~=0)
rent=rent+200;
end
i=mod(month,12);
if(i==0 && month~=0)
monthlyWageAfterTaxes=monthlyWageAfterTaxes+0.02*monthlyWageAfterTaxes;
end
month=month+1;
end
disp(strcat('Total Savings :',int2str(savings)));
%%%%% EOF %%%%%%%%%%
%% OUTPUT
% give amount of time (user input in years):
% 2
% Total Savings :71273
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.