nog
Class Participants

java.lang.Object
  |
  +--nog.Participants

public class Participants
extends java.lang.Object

Contains a number of participants.


Constructor Summary
Participants()
          Default constructor.
Participants(Participants p)
          Constructor wich creats a copy of the Participants.
Participants(java.lang.String filename)
          Constructor with the filename as a String as input.
 
Method Summary
 boolean addPart(java.lang.String pString)
          Adds a participant to Participants.
 void clearPart()
          Clears the list with participants.
 java.lang.String get_filename()
          Returns the filename of the file.
 java.util.Hashtable get_ht()
          Returns the Harstable.
 int getCnt()
          Returns the number of participants in Participants.
static void main(java.lang.String[] args)
          The main wich reads the "part.txt"-file and calculats the statistics.
 void stat_all()
          Starts the calculation of the statistics.
 int stat_country(java.lang.String s)
          Returns the share of that specific country.
 double stat_female()
          Returns the share of female in %.
 double stat_height()
          Returns the average height.
 double stat_men()
          Returns the share of men in %.
 int stat_sport(java.lang.String s)
          Returns the share of that specific sport.
 double stat_weight()
          Returns the average weight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Participants

public Participants()
Default constructor. Opens the "part.txt" file.

Participants

public Participants(Participants p)
Constructor wich creats a copy of the Participants.
Parameters:
p - the Participants to copy.

Participants

public Participants(java.lang.String filename)
Constructor with the filename as a String as input.
Parameters:
filename - the filename to open.
Method Detail

get_filename

public java.lang.String get_filename()
Returns the filename of the file.
Returns:
the filename.

get_ht

public java.util.Hashtable get_ht()
Returns the Harstable.
Returns:
the Harstable.

stat_height

public double stat_height()
Returns the average height.
Returns:
the average height.

stat_weight

public double stat_weight()
Returns the average weight.
Returns:
the average weight.

stat_men

public double stat_men()
Returns the share of men in %.
Returns:
the share of men in %.

stat_female

public double stat_female()
Returns the share of female in %.
Returns:
the share of female in %.

stat_country

public int stat_country(java.lang.String s)
Returns the share of that specific country.
Parameters:
s - the country to get statistic about.
Returns:
the share of that specific country.

stat_sport

public int stat_sport(java.lang.String s)
Returns the share of that specific sport.
Parameters:
s - the sport to get statistic about.
Returns:
the share of that specific sport.

stat_all

public void stat_all()
Starts the calculation of the statistics.

getCnt

public int getCnt()
Returns the number of participants in Participants.
Returns:
the umber of participants.

addPart

public boolean addPart(java.lang.String pString)
Adds a participant to Participants.
Parameters:
pString - the string containing all info about the participant to add.
Returns:
true if ok, false if something got wrong.

clearPart

public void clearPart()
Clears the list with participants.

main

public static void main(java.lang.String[] args)
The main wich reads the "part.txt"-file and calculats the statistics.