// Player.java // Class for a player in the Chips game. // Written by THC for CS 5 Lab #1. public class Player { private String myName; // player's name private int myChips; // how many chips the player has // Constructor. Stores the player's name and sets the number of chips to 0. public Player(String name) { myName = name; // save the name myChips = 0; // no chips taken yet } // Return this player's name. public String getName() { return myName; } // Return how many chips this player has. public int getChips() { return myChips; } // Add some chips to this player's pile. public void addChips(int added) { myChips += added; } // Return a String describing this player. public String describe() { String description; // String describing this player description = myName + " has " + myChips + " chip"; if (myChips == 1) description += "."; else description += "s."; return description; } }