Skater
Class Skater

java.lang.Object
  |
  +--Skater.Skater

public class Skater
extends java.lang.Object


Field Summary
static double MAX_SCORE
           
static double MIN_SCORE
           
 
Constructor Summary
Skater()
          Creates a default new instance of Skater
Skater(java.lang.String nam, java.lang.String nation)
          Creates a new instance of Skater with name and country known
 
Method Summary
 boolean equals(java.lang.Object obj)
          report whether two skaters are considered the same Need a policy decision here For now, consider them the same if they have the same name and country
 double getArtRating()
          Calculate and report the skater's total artistic rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Artistry Scores, even if the scores themselves havn't been altered from default 0
 java.lang.String getCountry()
          report skater's country
 java.lang.String getName()
          report skater's name
 double getNthArtScore(int n)
          report Nth judge's score for this skater on artistry if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception
 double getNthTechScore(int n)
          report Nth judge's score for this skater on technical skill if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception
static int getNumJudges()
          static method to get how many judges there are
 double getTechRating()
          Calculate and report the skater's total technical rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Tech Scores, even if the scores themselves havn't been altered from default 0
 double getTotalRating()
          calculate and report skater's total score - artistic + technical
 int hashCode()
          Calculate a hash code for a Skater Object Overrides Object version From what I understand, in order to make some collections classes work, if you override toString / equals you should override hashCode (Unfortunately, my decisions on toString and equals are not consistent with each other :-) )
static void main(java.lang.String[] args)
           
 void setCountry(java.lang.String nam)
          change skaters country Assumes country is ok, regardless Could use a lookup in fancier class
 void setName(java.lang.String nam)
          change skaters name Assumes name is ok, regardless
 boolean setNthArtScore(int n, double score)
          set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score
 boolean setNthTechScore(int n, double score)
          set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score
static boolean setNumJudges(int num)
          Change the number of judges Policy Decision: Don't accept change if there have been skaters created Could be controversial - we might have different competitions with different numbers of judges but in that case, we should make numJudges non-static
 java.lang.String toString()
          give an output friendly representation of the skater Overrides Object version Policy decision: show name, country, artistic and technical ratings if available, and total if available
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SCORE

public static final double MAX_SCORE
See Also:
Constant Field Values

MIN_SCORE

public static final double MIN_SCORE
See Also:
Constant Field Values
Constructor Detail

Skater

public Skater()
Creates a default new instance of Skater


Skater

public Skater(java.lang.String nam,
              java.lang.String nation)
Creates a new instance of Skater with name and country known

Method Detail

equals

public boolean equals(java.lang.Object obj)
report whether two skaters are considered the same Need a policy decision here For now, consider them the same if they have the same name and country

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
give an output friendly representation of the skater Overrides Object version Policy decision: show name, country, artistic and technical ratings if available, and total if available

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Calculate a hash code for a Skater Object Overrides Object version From what I understand, in order to make some collections classes work, if you override toString / equals you should override hashCode (Unfortunately, my decisions on toString and equals are not consistent with each other :-) )

Overrides:
hashCode in class java.lang.Object

getName

public java.lang.String getName()
report skater's name


getCountry

public java.lang.String getCountry()
report skater's country


getNumJudges

public static int getNumJudges()
static method to get how many judges there are


getTechRating

public double getTechRating()
Calculate and report the skater's total technical rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Tech Scores, even if the scores themselves havn't been altered from default 0


getArtRating

public double getArtRating()
Calculate and report the skater's total artistic rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Artistry Scores, even if the scores themselves havn't been altered from default 0


getTotalRating

public double getTotalRating()
calculate and report skater's total score - artistic + technical


getNthArtScore

public double getNthArtScore(int n)
report Nth judge's score for this skater on artistry if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception


getNthTechScore

public double getNthTechScore(int n)
report Nth judge's score for this skater on technical skill if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception


setName

public void setName(java.lang.String nam)
change skaters name Assumes name is ok, regardless


setCountry

public void setCountry(java.lang.String nam)
change skaters country Assumes country is ok, regardless Could use a lookup in fancier class


setNumJudges

public static boolean setNumJudges(int num)
Change the number of judges Policy Decision: Don't accept change if there have been skaters created Could be controversial - we might have different competitions with different numbers of judges but in that case, we should make numJudges non-static


setNthArtScore

public boolean setNthArtScore(int n,
                              double score)
set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score


setNthTechScore

public boolean setNthTechScore(int n,
                               double score)
set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score


main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments