Pick 10 of your favourite NBA or NHL players from 2 top teams. Research on the Internet, and find some statistics for the selected players, statistics related to some recent games (for example, for NBA, the number of shots, the number of rebounds, and the numbers of assists). Create a text file, containing the collected data, in the following format:
Player Team Points Rebounds Assists
Dirk-Nowitzki (Dallas-Mavericks) 24 11 5
Dwyane-Wade (Miami-Heat) 36 8 6
LeBron-Jame (Miami-Heat) 20 8 10
Shawn-Marion (Dallas-Mavericks) 20 6 6
Chris-Bosh (Miami-Heat) 12 4 5
Jason-Terry (Dallas-Mavericks) 16 3 6
DeShawn-Stevenson (Dallas- Mavericks) 12 3 5
Mario-Chalmers (Miami-Heat) 9 1 4
Peja-Stojakovic (Dallas- Mavericks) 2 1 1
Mike-Miller (Miami-Heat) 7 2 3
Write a program that calculates and outputs the mean and the median for each of set of data (the number of points, number of rebounds, and the number of assists), for each team. 3 sets of data x 2 teams= 6 sets of data, 6 sets of data x 2 statistics (mean, median) = 12 outputs.
The program should follow the guidelines:
The number of points, rebounds, and assists for each team should be read from a .txt file and loaded into appropriately named arrays. The name of the file should be entered by user.
The mean and the median are to be calculated using methods. Remember that the median of an even number of marks is the average of the two middle marks. The methods should have an array as a parameter and return the value of mean or median.
The statistics – mean and median- should be displayed on the output console.
The statistics – mean and median- should also be printed in a text file.
To sort the arrays, you can use the Arrays.sort (arrayname) method. (You will need to import java.util.Arrays).
Be aware that the complexity of your application has a direct impact on your mark. Your program must be user friendly, and it should also have appropriate messages. At this point in the course, use all the features of the language that you have learned, and read the API to apply new ideas to your source code. Your solutions must be OOP in nature.
Your application must include:
Methods
arrays
Selection and Repetition Structures
Appropriate Variables Types
Properly formatted/commented source code
make it as simple as possible
Edited by Roger, 21 February 2013 - 11:09 AM.
tags