The name of the first lover


Function Name: loveCalculator
% Inputs (2): - (char) The name of the first lover.
% - (char) The name of the second lover.
% Outputs (1): - (double) The love score for the two names.
Your old friend sends you a link to the pinterest post, and you decide
% to write a function called loveCalculator that takes in two names as
% strings and returns their love score.
%
% There are a few rules about the love score:
% 1- If their names are the same, they obvi can't be in love, so their
% score is zero.
% 2- If one name is contained in the other, their score is zero.
% (harold and haroldine cannot live happily ever after)
% 3- If they are different,
% a- Gather all the L's O's V's E's and S's (not case sensitive)
% from both names such that you have a vector that contains their
% total count. ([#L's, #O's, #V's, #E's, #S's])
% b- Add neighboring values together until you arrive at a vector
% of length 2
% [a b c d e]
% [a+b b+c c+d d+e]
% [(a+b)+(b+c) (b+c)+(c+d) (c+d)+(d+e)]
% etc. until it looks like: [x,y]
% c- Then, their love score is 10*x + y
Hints:
% - The strfind() function might be helpful.
% - Your function should not be case-sensitive (i.e. 'JOHN' and 'john'
% as your inputs should return a score of 0).
%
% Test Cases:
% score1 = loveCalculator('This Homework', 'Me');
% score1 => 0
%
% score2 = loveCalculator('Ron', 'Hermione');
% score2 => 88
%
% score3 = loveCalculator('Taylor', 'Taylor');
% score3 => 0

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: The name of the first lover
Reference No:- TGS089520

Expected delivery within 24 Hours