Po = 300.00 % older brother\'s initial investment
 r = 0.05 % interest rate for both brothers - annual
 t = linspace(0,50) % years
 A1 = Po*exp(r*t) % older brother equation
 A2 = Py*exp(r*t) % younger brother equation
 plot(t,A1,\'-.Dc\',t,A2,\'--*b\')%plotting money in account over 50 years
 xlabel(\'t (time)\')
 ylabel(\'A (total amount in account $)\')
 title(\'Total Amount in Account vs. Time\')
 legend(\'Older\',\'Younger\')
 A1(end)
 A2(end)
 Sottile - Fall 2015 CMPSC 200 Programming for Engineers with MATLAB Lab 4 Instructions: Create a single script (.m file) to solve this problem. Unless directed otherwise, use meaningful variable names for each variable; do not use the default variable ans to store your results. Suppress your output for every calculation or allocation with a semi-colon. Each problem should be in a separate cell, using the cell mode feature of MATLAB Please remember to follow the programming style sheet on ANGEL. When complete, please submit your code to the dropbox on ANGEL; the graders will run it to view your output. Name your file like this: username lab4. m (example: bis 5332 1ab4·m). Your submission must be a single .m file Problem 1 (5 points) Open your submission for Lab 2, and copy/paste the code into your script for Lab 4. Correct anything that the graders gave you feedback on (if applicable) and semicolon all your calculation statements; in other words, no variables should display to the screen unless manually printed out. At the bottom of your code existing code, add the following items: Use disp statements to print the two brothers\' starting account balances to the Command Window. Use fprintf statements to print the brother\'s ending account balances to the Command Window Make your output in the Command Window look like this: Older Brother\'s balance is XX.XX at Y year:s Younger Brother\' s balance is $XX.XX at Y years Older Brother\'s balance is $XX.XX at Z years Younger Brother\' s balance is $XX.XX at Z years Replace the X placeholders with the correct balances, as appropriate. For the final account balances, use as many spaces as needed preceding the decimal, but only using two decimal places - round if necessary. Replace the Y placeholders with the initial time, and the Z placeholders with the final time; make sure the values for Y and Z display as integers. Use fprintf to print your explanation of why it makes sense to invest early in life to a file on the desktop called username lab4 explanation.txt (example: bjs5332 lab4 explanation.txt.) Reminder: Anytime you open a file, you should always remember to close it. Sottile - Fall 2015 
Py = 1100.00;% younger brother\'s initial investment
 Po = 300.00; % older brother\'s initial investment
 timeolder=0;
 nameolder=\'Older brother\';
 X = sprintf(\'%s balance is %d at %d years.\',nameolder,Po,timeolder);
 disp(X);
 timeyounger=0;
 nameyounger=\'Younger brother\';
 Y = sprintf(\'%s balance is %d at %d years.\',nameyounger,Py,timeyounger);
 disp(Y);
 r = 0.05; % interest rate for both brothers - annual
 t = linspace(0,50); % years
 A1 = Po*exp(r*t); % older brother equation
 A2 = Py*exp(r*t); % younger brother equation
 A1(end);
 A2(end);
 timeolderfinal=50;
 nameolder=\'Older brother\';
 T = sprintf(\'%s balance is %d at %d years.\',nameolder,A1(end),timeolderfinal);
 fprintf(T);
 timeyoungerfinal=50;
 nameyounger=\'Younger brother\';
 W = sprintf(\'%s balance is %d at %d years.\',nameyounger,A2(end),timeyoungerfinal);
 fprintf(W);
 plot(t,A1,\'-.Dc\',t,A2,\'--*b\')%plotting money in account over 50 years
 xlabel(\'t (time)\');
 ylabel(\'A (total amount in account $)\');
 title(\'Total Amount in Account vs. Time\');
 legend(\'Older\',\'Younger\');
 A1(end);
 A2(end);