Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB help, please!!!!! I need help writing a Matlab program that will prompt f

ID: 3715231 • Letter: M

Question

MATLAB help, please!!!!!

I need help writing a Matlab program that will prompt for the current day and number of shipping days (elapsed) days for an online purchase. Then, determine the day of the week the item is expected to arrive. Simplify the program by allowing an item to ship an arrive on any day of the week, including weekends.

inputs: day of the week, string (three symbol day) and elapsed days (int)

outputs: current day of the week and future day of the week.

** Needs to be in Matlab format, not java***

Sample Output Enter a day of the week: Sun Sunday Mon Monday Tue Tuesday Wed Wednesday Thu Thursday Fri Friday Sat - Saturday thu Enter number of shipping days 16 16 days from Thursday is Saturday Enter a day of the week: Sun Sunday Mon Monday Tue Tuesday Wed Wednesday Thu Thursday Fri Friday at Saturday flat Error! Day cannot be determined

Explanation / Answer

str={'sun','mon','tue','wed','thu','fri','sat'};

str1={'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'};

prompt= 'Enter a day of the week: Sun -Sunday Mon -Monday Tue-Tuesday Wed-Wednesday Thu-Thursday Fri-Friday Sat-Saturday ';

string1=input(prompt,'s');

%fprintf('%s',string1);

prompt='Enter the days of shipping';

k=find(strcmp(str,string1));

if(k>0)

z=input(prompt);

x = mod(z,7);

if(x+k<=7)

X=sprintf('%d days from %s is %s',z,str1{k},str1{x+k});

disp(X);

else

X=sprintf('%d days from %s is %s',z,str1{k},str1{mod(x+k,7)});

disp(X);

end

else

fprintf('Error!Day cannot be determined');   

end