Description
Description
To get started on this lab, type the following while logged in to tc.rnet.missouri.edu: DON’T FORGET THIS
cs1050start lab13
For the lab assignment, you are to start with the starter code provided in the lab13 directory.This is basically a solution to the prelab, so it should look somewhat familiar.Note that this is just code to get you started.You may prefer to use your own prelab code instead, especially if you defined some cool new structs in your code.
Your job in this lab is to calculate 3 new statistics for the baseball players from your prelab.These statistics are:
- Batting Average (AVG) – This is total hits divided by at-bats.To calculate total hits, just add singles plus doubles plus triples plus home runs.
- On-base Percentage (OBP) – This is (total hits plus walks) divided by (at-bats plus walks).Use the definition of total hits as above.
- Slugging Percentage (SLUG) – This is total bases divided by at-bats.Total bases = singles + 2*doubles + 3*triples + 4*homeruns.
Once you have these statistics calculated for all of the players, you will print out the players along with these stats in 4 different sorting orders:
- The initial orders the players are read in by GetNextPlayer() (this is really in ascending order by ID).
- By batting average descending (this means print the player with the highest batting average first, the second highest batting average second, etc.)
- By on-base percentage descending (highest obp down to lowest obp)
- By slugging percentage descending (highest slug down to lowest slug)
Unformatted Attachment Preview
Purchase answer to see full attachment
Explanation & Answer
I almost sure that this is true.But I couldn't test it because profe...