/**
 * Player represents a hockey player.
 */
public class Player {
  
  /**
   * this Player's name
   */
  private String name;
  
  /**
   * this Player's number
   */
  private int number;
  
  /**
   * this Player's team
   */
  private String team;
  
  /**
   * create a Player named name, with
   * number, uh, number
   */
  public Player(String name, int number) {
    this.name= name;
    this.number= number;
  }
  
  /**
   * return an interesting String describing
   * this Player
   */
  public String toString() {
    return "Name:\n" + name +
      "\nNumber:\n" + number +
      "\nTeam:\n" + team;
  }
  
  /** 
   * is this Player equal to other?
   */
  public boolean equals(Player other) {
    return this.name.equals(other.name) &&
        this.number == other.number &&
      equals(this.team, other.team);
  }
  
  /**
   * determine whether two Strings are equal,
   * even if the first one is null
   */
  private boolean equals(String s1, String s2){
    if (s1 == null && s2 == null) {
      return true;
    }
    else if (s1 != null && s2 != null) {
      return s1.equals(s2);
    }
    else {
      return false;
    }
  }
}

/*
 * There's more to be done with the equals method.
 * If p1 is a Player with a String stored in name, and p2
 * has a null stored in name, then p1.equals(p2) gives
 * you a different result than p2.equals(p1).  Think of an
 * easy ways to fix this.
 */

   
