Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: lovePentagran Inputs: 1. (char) Name of first mpettor 2. (char) Name of second competitor Outputs 1. (char A sentence describing who wins the

image text in transcribed
image text in transcribed
Function Name: lovePentagran Inputs: 1. (char) Name of first mpettor 2. (char) Name of second competitor Outputs 1. (char A sentence describing who wins the game Background: Valentine's Day is coming up, and a group of friends are trying to find dates. Unfortunately, they all have their eyes set on the same crush- MATLAB. It looks like they will have to settle it will an intense game of rock paper scissors Function Description Write a MATLAB function that will determine who is worthy enough to claim MATLAB as their bae by comparing two strings given as inputs. The ONLY inputs we will use to test your function are: 'Chad, Brad,Drew, "Kyle,Mike, and "No-show Then compare them according to the following rules: "Chad' beats both Brad' and Kyle Brad' beats bothKyle' and 'Mike Mike' beats both Drew' and Chad . "Kyle' beats both "Mike and 'Drew e Drew' beats both Chad and Brad e If one of the inputs is No-show', then that means that person didn't show up, and the other competitor wins by default After determining who wins, output one of the following strings: e If there is a winner O cwinner> beats closer>l He has proven his worth to MATLAB e If either of the competitors is a no-show o cwinner>'s opponent didn't show up! Looks like MATLAB will choose him! Here is a convenient diagram to demonstrate who beats who: Chad Drew Brad Kyle Mike Example: >winner- lovePentagram('KyleBrad') winner .Brad beats Kyle! He has proven his worth to MATLAB.. Notes: The competitors will never be both no-shows No compettor will ever face themself. Hint: Switch statements may prove 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

Recommended Textbook for

Students also viewed these Databases questions