An engineering company has run into financial difficulty on a project. You have
ID: 3574309 • Letter: A
Question
An engineering company has run into financial difficulty on a project. You have been hired to audit the companys books and come out with a recommendation for the companys financiers. Specifically you want to determine the current financial standing of the company. Your audit team has gathered the following information: Checking account balance: $ 3,642.32 Savings account balance: $ 4,815.65 Pending transactions on the checking account: -2800.37, 900.32, -1452.92, -920.36, -1854.32, -1800.59, 799.99, 689.32, 556.81, 412.32, -4789.1, -2369.57. (Negative values indicate withdrawal and positive values indicate deposit). If the checking balance after any transaction falls below zero the bank assesses a fee of $100, and offsets the deficit by automatically subtracting from the savings account. If the savings balance is insufficient to offset the checking deficit, then a partial offset is made up to the amount available in the savings account, and the checking account goes into overdraft and is assessed a fee of $350 per transaction. The savings account is never allowed to go into overdraft. a. Set up a script (.m) file to apply the pending transactions, and correctly assess low balance fees to checking and savings, where applicable. After the final transaction you should have the final updated account balances in both accounts. Run your script file. (20 points) b. Use the Matlab output command fprintf to display the checking balance, the savings balance, and the number of times each fee was assessed. (5 points) c. Plot two graphs of the savings balance and the checking balances versus the transaction number. You may plot both graphs on one figure using different colors or linetypes; or you may use the subplot method. (10 points) d. Provide comments in your Matlab code that would enable an independent non-specialist third party to follow along with what your program is attempting to achieve. (5 points)
Explanation / Answer
clear all
savingAccount=4815.65;
checkingAccount=3642.32;
transactions=[-2800.37, 900.32, -1452.92, -920.36, -1854.32, -1800.59, 799.99, 689.32, 556.81, 412.32, -4789.1, -2369.57];
l=linspace(1,12,12);
n=1;
for i=1:12
if transactions(i)<0
if checkingAccount<(-1*transactions(i))
checkingAccount=checkingAccount+transactions(i)-100
if (-1*checkingAccount)<=savingAccount
savingAccount=savingAccount+checkingAccount
checkingAccount=0
else
checkingAccount=checkingAccount+savingAccount
savingAccount=0
checkingAccount=checkingAccount-350
end
else
checkingAccount=checkingAccount+transactions(i)
end
else
checkingAccount=checkingAccount+transactions(i)
end
s(i)=savingAccount;
c(i)=checkingAccount;
disp(savingAccount)
disp(checkingAccount)
end
disp(savingAccount)
disp(checkingAccount)
s
c
plot(l,s,'r')
hold on
plot(l,c,'g')
ylabel('balance'),xlabel('transaction no')
legend('checkingAccount','savingAccount')