Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB PROBLEM Function Name: majorLeagueStats Inputs: 1. (char) Player's name 2. (double) Value of player's strength 3. (double) Value of player's agility 4. (double) Value
MATLAB PROBLEM
Function Name: majorLeagueStats Inputs: 1. (char) Player's name 2. (double) Value of player's strength 3. (double) Value of player's agility 4. (double) Value of player's speed 5. (char) Player's handedness Outputs: 1. (char) A string determining whether or not a player is qualified to play in Nationals Topics: (if conditionals), (switch conditionals), (nested conditionals) Background: You are the new head coach for the Atlanta Braves' renowned baseball team. Unfortunately, you're only allowed to take a certain amount to the Nationals this year. On top of that, there were a record number of players on the team this year, and you have no idea how to select your top players. However, luckily for you, you went to Georgia Tech and took 1371 back in the day. Time to put your MATLAB skills into use! Function Description: You're given information on a player's name (input 1), strength (input 2), agility (input 3), speed (input 4) and handedness (input 5). First calculate the players total speed stat by multiplying agility and speed. Then, determine the player's position. If the player's handedness is 'right' and their total speed stat is greater than or equal to their total strength stat, their position is 'outfielder', otherwise it is 'batter'. If a player's handedness is 'left' and their total speed is less than their strength, their position is 'pitcher', otherwise, their position is 'batter'. Finally, if the handedness is 'both', the player's position is 'pitcher'. Next, you will determine if the player will make it to Nationals. If the player is a batter they can make it to nationals if either their strength stat or total speed stat is at least 25000. If the player is an outfielder, they will make it to Nationals if their total speed stat is at least 50000. If the player is a pitcher, they will automatically make it to Nationals if their handedness is 'both', but they can also make it if their strength score is at least 100000. Finally, output a string detailing what happened to the player. . Output a different string depending on whether or not the player qualifies for Nationals. If the player qualifies, output: CONGRATULATIONS!
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