Special offer for new customers: 5% OFF your first order! Use coupon: GWRITERSclose

1st exercise

Exercise 1
Guidelines
This assignment is to familiarize yourself with C# while making sure you completed 1181 with all of the
requisite knowledge to do well in this class.
NOTE: This assignment is similar to things we did in 1181. If you have trouble solving this solution on your
own, it may be wise to consider retaking 1181.
Instructions
You will need to read in a text file of baseball players and their statistics from the provided text file named
“players.txt”. Then you will need to print out the top ten players sorted by RBI as well as all of their statistics in
tabular form and in descending RBI order. Then as per the user’s
request, you will need to print the answer for each of the following
options:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Legend: POS = Position, HR = Home Runs, RBI = Runs Batted In, AVG = Batting Average
Requirements
 Read in the players and statistics from the file(players.txt) once. You are not to read in the file for every
request.
o Hint: some arrays would be a good idea.
 Sort the list in descending order by the runs batted in (RBI). You may not use the built in sort functions,
you will need to write your sort algorithm. You must use the bubble, selection, or insert sort from 1181.
 Print the top ten results in tabular form. You must include a header row on your tabular output. You
will need to output all of the columns of data even though you are not sorting based on them.
 After displaying the top ten results, prompt the user using a menu to select which option to choose; get
maximum runs batted in, minimum home runs, average batting average, and standard deviation of
batting averages.
 Capture the user’s input. All user input must be validated. The file name is not considered user input.
 Display the appropriate value based on selection.
o Hint: use the same function the gets the average when calculating the standard deviation.
 Prompt the user to continue and proceed as appropriate.
 You must use methods. This solution should have lots of methods.
o Methods that do the following are the minimum that you should have: display a menu, get
user’s choice, sort list, display table, get maximum RBI, get minimum HR, get average batting
average, get standard deviation for batting averages.
 My example has colors, these are not expected nor required.
Grading
Grading will be based on completion of the requirements.
Standard Deviation Formula using total
Population
Example output
Player Team Position HomeRuns RBIs Batting Average
Arenado, N COL 3B 42 130 0.287
Donaldson, J TOR 3B 41 123 0.297
Davis, C BAL 1B 47 117 0.262
Bautista, J TOR RF 40 114 0.25
Encarnacion, E TOR 1B 39 111 0.277
Goldschmidt, P ARI 1B 33 110 0.321
Ortiz, D BOS DH 37 108 0.273
Morales, K KC DH 22 106 0.29
Cespedes, Y NYM LF 35 105 0.291
Martinez, J DET RF 38 102 0.282
Which of the following do you wish to show:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Your choice is:a
I am sorry, I do not understand; please try again.
Which of the following do you wish to show:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Your choice is:1
Maximum RBI: 130
Do you wish to continue?(Y/N) 2
I am sorry, I do not understand; please try again.
Do you wish to continue?(Y/N) y
Which of the following do you wish to show:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Your choice is:2
Minimum Home Runs: 2
Do you wish to continue?(Y/N) y
Which of the following do you wish to show:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Your choice is:3
Average Batting Average: 0.272
Do you wish to continue?(Y/N) y
Which of the following do you wish to show:
1. Maximum Runs Batted In
2. Minimum Home Runs
3. Average Batting Average
4. Standard Deviation of Batting Average
Your choice is:4
Batting Average Standard Deviation: 0.0254
Do you wish to continue?(Y/N)

Responses are currently closed, but you can trackback from your own site.
Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes