|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectScoreKeeper
public class ScoreKeeper
A class that models a simple basketball scorekeeper, keeping track of overall score and shooting percentages for 3 point field goals, 2 point field goals, and free throws.
| Constructor Summary | |
|---|---|
ScoreKeeper()
Creates a new ScoreKeeper object. |
|
| Method Summary | |
|---|---|
double |
getPercent(int points)
Gets the current shooting percentage for a type of shot. |
int |
getScore()
Gets the current score. |
void |
made(int points)
Records a made shot, either a 3 point FG, 2 point FG, or free throw. |
void |
missed(int points)
Records a missed shot, either a 3 point FG, 2 point FG, or free throw. |
void |
reset()
Resets the score and all related stats. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScoreKeeper()
| Method Detail |
|---|
public void reset()
public void missed(int points)
points - the number of points associated with the shot (3, 2 or 1)public void made(int points)
points - the number of points associated with the shot (3, 2 or 1)public int getScore()
public double getPercent(int points)
points - the type of shot (3 = 3pt FG, 2 = 2pt FG, 1 = free throw)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||