Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: lyrics Inputs 1. (char) A character vector containing the title and artist of a song, separated by a comma 2. (char) A character

image text in transcribed

Function Name: lyrics Inputs 1. (char) A character vector containing the title and artist of a song, separated by a comma 2. (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 prove yourself- as the headlining DJ of Music Midtown! Not wanting to ruin have the chance to 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 eams 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 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... Homework 4 - Logicals Hints Perfoming a mathematical operation on a logical will result in its automatic conversion to a double Vectors of the same length can be multiplied together elementwise using .* . You may find the strtok() and sprintf() functions to be useful

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago