Class Player

java.lang.Object
  |
  +--Player
All Implemented Interfaces:
java.lang.Comparable

public class Player
extends java.lang.Object
implements java.lang.Comparable

Class Player A class that models a player in a golf tournament.


Constructor Summary
Player()
          constructor builds the player with default values
Player(java.lang.String fn, java.lang.String ln, int r1, int r2)
          constructor builds the player with the supplied parameters
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares two Players based on their score If not passed a Player, 0 is returned
 java.lang.String getFName()
          returns first name of the player
 java.lang.String getLName()
          returns last name of the player
 int getRound1()
          returns first round score
 int getRound2()
          returns second round score
 int getTotal()
          returns total score
 java.lang.String toString()
          returns player information as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(java.lang.String fn,
              java.lang.String ln,
              int r1,
              int r2)
constructor builds the player with the supplied parameters
Parameters:
first - name of the player
last - name of the player
score - of first round
score - of second round

Player

public Player()
constructor builds the player with default values
Method Detail

getFName

public java.lang.String getFName()
returns first name of the player
Returns:
first name of player

getLName

public java.lang.String getLName()
returns last name of the player
Returns:
last name of player

getRound1

public int getRound1()
returns first round score
Returns:
first round score

getRound2

public int getRound2()
returns second round score
Returns:
second round score

getTotal

public int getTotal()
returns total score
Returns:
total score

toString

public java.lang.String toString()
returns player information as a String
Overrides:
toString in class java.lang.Object
Returns:
last name, first name, round 1 score, round 2 score, total score

compareTo

public int compareTo(java.lang.Object obj)
Compares two Players based on their score If not passed a Player, 0 is returned
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
Player - object to compare with
Returns:
<0 if the passed player has a lower score 0 if the scores are equal >0 if the passed player has a higher score