Code
% Dedication.m
clc
fprintf('\nDEDICATIONS: \n\n');
for author = {'Brad' 'Jon' 'David'}
authorstring = char(author);
switch authorstring
case 'Brad'
Dedication.to = 'Elizabeth Spillman-Wyble';
Dedication.features = ...
{'inspiration','storytelling',...
'mastery of folklore',...
'extraordinary cooking'};
case 'Jon'
Dedication.to = 'Virginia Vaughan';
Dedication.features = ...
{'intelligence','strength of character',...
'unfailing support','generosity'};
case 'David'
Dedication.to = 'Judith Kroll';
Dedication.features = ...
{'brilliance', 'bravery', 'beauty'};
end
fprintf('%s dedicates this work to %s',...
authorstring,Dedication.to);
fprintf(' in grateful recognition of her ');
for featurecount = 1:length(Dedication.features)-1
fprintf('%s, ',...
Dedication.features{featurecount});
end
fprintf('and %s.\n\n',Dedication.features{end})
end
commandwindow
Output:
DEDICATIONS:
Brad dedicates this work to Elizabeth Spillman-Wyble in grateful recognition of her inspiration, storytelling, mastery of folklore, and extraordinary cooking.
Jon dedicates this work to Virginia Vaughan in grateful recognition of her intelligence, strength of character, unfailing support, and generosity.
David dedicates this work to Judith Kroll in grateful recognition of her brilliance, bravery, and beauty.