Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MatLab!!!! Please help me build a function by NOT USING Conditional Statement ( IF) Thanks!!! Test Case: out = lyrics('Delicate,Taylor Swift', 'This ain't for the
MatLab!!!!
Please help me build a function by NOT USING Conditional Statement ( IF)
Thanks!!!
Test Case:
out = lyrics('Delicate,Taylor Swift', 'This ain't for the best. My reputation's never been gold, so you must like me for me. Yeah, I want you. We can't make 1371 promises now, can we, babe?')
Function Name: lyrics Inputs 1. 2. (char) A character vector containing the title and artist of a song, separated by a comma (char) A character vector containing the lyrics to a song Outputs 1. (char) A vector of characters describing your opinion of the song Background All your life you have aspired to become the greatest DJ in the world. Soon, you will have the chance to prove yourself- as the headlining DJ of Music Midtown! Not wanting to ruin this once in a lifetime opportunity, you want to ensure all the songs you remix and sample are the best of the best. You realize there's not enough time to go through thousands of lyrics, so you use your best friend MATLAB to help you get the job done! Function Description Write a function that uses the following criteria to rate a song's lyrics 1. If the song mentions either'MATLAB' or 1371' at least once, it earns 20 points 2. If the song is performed by Taylor Swift, it earns 10 points 3. If the song is performed by Kanye West, it loses 5 points 4. If the song mentions your favorite color, "gold', and does not mention your least favorite color, 'red, it earns 15 points Your function should output a vector of characters in the following format: song title> received a score of score> points.' Example >outlyrics('Delicate, Taylor Swift', 'This ain't for the best. My reputation's never been gold, so you must like me for me. Yeah, I want you. We can't make 1371 promises now, can we, babe?") out -'Delicate received a score of 45 points." Notes: . Taylor Swift', 'Kanye West', and 'MATLAB will appear exactly as shown, case sensitive . You should ignore case when finding'red' and 'gold'. If these words appear as part of another word, you should still count them You should not use conditionals to solve this problem . Continued
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started