Question: Homework 6-Conditionals Function Name: ruleOfSeven Inputs 1. (double) Your age 2. (double) The age of a potential partner Outputs: 1. (char) A string describing whether

Homework 6-Conditionals Function Name: ruleOfSeven Inputs 1. (double) Your age 2. (double) The age of a potential partner Outputs: 1. (char) A string describing whether you can date the potential partner or not Background Well, it's that time of the year again. Valentine's month. In those dark times you decide to use a tool you promised yourself you would never dabble with, but here you are swiping left and right (and maybe up if you're really into it) on Tinder. Not sure about whether a certain partner is too young for you, you decide to use your good friend MATLAB to figure this out. Function Description: Given your age and the age of a potential partner, write a function that determines whether the potential partner is too young for you or whether their age is close enough to yours. Use the following formula to determine the minimum age of someone you could date based on your own age your age Minimum age of a partner- + 7 If the potential partner is too young for you, output the string 'I'm gonna have to swipe left on you.'If the potential partner is older than or the same age as the minimum age you could date output the string 'Love might just be in the air tonight!'If the potential partner is younger than 18 years old, output the string 'This is illegal! no matter what your age is Example: yourAge-25; potentialPartnerAge 18; str- ruleOfSeven(yourAge, potentialPartnerAge); str 'I'm gonna have to swipe left on you. Notes . If the age you get from the formula is not a whole number, round it down . Use two apostrophes to put an apostrophe in a string (Ex: 'Valentine's Day' should be written 'Valentine' 's Day)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
