•

Check out our Community Blogs

Register and join over 40,000 other developers!

### Recent Blog Entries

• phi

I love this community !

• JackJames

hi i am jack i am seo expert jack james would love you to read new post

# Calculate Mean and Median Value of Data Set

mean median value data calculate

2 replies to this topic

### #1 javaprogramer

javaprogramer

CC Lurker

• Just Joined
• 2 posts

Posted 16 January 2012 - 05:23 AM

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
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.
 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

• 0

Programming God

• Senior Member
• 897 posts
• Learning:C, Java, C++, C#, PHP, Python, PL/SQL

Posted 16 January 2012 - 07:53 AM

• 0

### #3 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts
• Location:Upstate, South Carolina
• Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
• Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 16 January 2012 - 08:25 PM

I don't like the NHL or NBA. Can I do it with Go and Chess players instead?

What about computing 95% confidence limits assuming a chi-squared distribution?

Calling this a "challenge" reminds me of when I let it be known on the manufacturing floor that I had a Master's in math, so one of the guys would ask me to do 3-digit addition problems. We don't do homework, we help you do homework.
• 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### Also tagged with one or more of these keywords: mean, median, value, data, calculate

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download