/** A tennis doubles team. */
public class DoublesTeam {
 
  /** The first player on the team. */
  private Player playerOne;

  /** The second player on the team. */
  private Player playerTwo;

  /** The number of team wins. */
  private int wins;
  
  /** The number of team losses. */
  private int losses;
  
  /**
   * Create a doubles team with players
   * p1 and p2.
   */
  public DoublesTeam(Player p1, Player p2) {
    playerOne = p1;
    playerTwo = p2;
  }
  
  /** 
   * Increment the team and players' wins.
   */
  public void won() {
    wins++;
    playerOne.won();
    playerTwo.won();
  }
  
  /**
   * A string representation of the doubles
   * team.
   */
  public String toString() {
    return "Team wins: " + wins 
      + " Team losses: " + losses + "\n" 
      + playerOne.toString() + "\n" 
      + playerTwo.toString();
  }
  
}

