Answered step by step
Verified Expert Solution
Link Copied!
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

image text in transcribed

image text in transcribed

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! has been selected to play in Nationals as a (n) {position>.' If the player does not qualify, output: ' was not qualified enough to play in Nationals as a (n) {position>. Try again next year!' . Example: name 'Lauren' strength = 16360 agility = 200000 speed = 76 handedness = 'right str = majorLeagueStats (same, strength, agility, speed, handedness) str 'CONGRATULATIONS! Lauren has been selected to play in Nationals as a (n) outfielder.' Notes: Pay close attention to your conditional operators. In the output string, print the player's name exactly as it was given to you

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_2

Step: 3

blur-text-image_3

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students explore these related Databases questions