Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -

Calculate Mean and Median Value of Data Set

mean median value data calculate

  • Please log in to reply
2 replies to this topic

#1 javaprogramer


    CC Lurker

  • Just Joined
  • Pip
  • 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
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.

  • 0

#2 fread


    Programming God

  • Senior Member
  • PipPipPipPipPipPip
  • 897 posts
  • Location:Trinidad and Tobago
  • Learning:C, Java, C++, C#, PHP, Python, PL/SQL

Posted 16 January 2012 - 07:53 AM

Are you asking someone to do your homework?
  • 0

#3 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/

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