diff options
| author | mo khan <mo@mokhan.ca> | 2019-08-11 17:38:24 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2019-08-11 17:38:24 -0600 |
| commit | a7abfd9f11d2d750cb2b45bfc9de8858a29f05f2 (patch) | |
| tree | 999ec6556bdb3b88a1f7bb9cd7c2f803bbbeac40 | |
| parent | a04f5ec262de028c843e38bf5864cd84953258b1 (diff) | |
add documentation and complete program profile
| -rw-r--r-- | src/Q8/BadmintonScoring.java | 19 | ||||
| -rw-r--r-- | src/Q8/BadmintonScoringWithStroke.java | 11 | ||||
| -rw-r--r-- | src/Q8/Point.java | 12 | ||||
| -rw-r--r-- | src/Q8/README.md | 17 |
4 files changed, 28 insertions, 31 deletions
diff --git a/src/Q8/BadmintonScoring.java b/src/Q8/BadmintonScoring.java index d3c8b29..47dce82 100644 --- a/src/Q8/BadmintonScoring.java +++ b/src/Q8/BadmintonScoring.java @@ -16,8 +16,7 @@ public class BadmintonScoring { private static final int PLAYER2 = 1; /** - * Creates an instance of the BadmintonScoring object with a 2D array of - * scores. + * Creates an instance of the BadmintonScoring object with a 2D array of scores. * * @param scores a 2D array of scores for each player. */ @@ -25,30 +24,22 @@ public class BadmintonScoring { this.scores = scores; } - /** - * @return the longest point streak for player 1. - */ + /** @return the longest point streak for player 1. */ public int getContinuousPointsPlayer1() { return this.longestStreakFor(PLAYER1); } - /** - * @return the longest point streak for player 2. - */ + /** @return the longest point streak for player 2. */ public int getContinuousPointsPlayer2() { return this.longestStreakFor(PLAYER2); } - /** - * @return the final score for player 1. - */ + /** @return the final score for player 1. */ public int getPlayer1Points() { return this.finalScoreFor(PLAYER1); } - /** - * @return the final score for player 2. - */ + /** @return the final score for player 2. */ public int getPlayer2Points() { return this.finalScoreFor(PLAYER2); } diff --git a/src/Q8/BadmintonScoringWithStroke.java b/src/Q8/BadmintonScoringWithStroke.java index 183ff05..4984402 100644 --- a/src/Q8/BadmintonScoringWithStroke.java +++ b/src/Q8/BadmintonScoringWithStroke.java @@ -16,8 +16,7 @@ public class BadmintonScoringWithStroke extends BadmintonScoring { private static final int PLAYER2 = 1; /** - * Creates an instance of this class with an ArrayList of points for each - * round. + * Creates an instance of this class with an ArrayList of points for each round. * * @param points a list of points for each round */ @@ -27,16 +26,12 @@ public class BadmintonScoringWithStroke extends BadmintonScoring { this.scores = to2DArray(points); } - /** - * @return the name of player 1's preferred stroke. - */ + /** @return the name of player 1's preferred stroke. */ public String getMostUsedStrokePlayer1() { return maxStrokeFor(Point.PLAYER1); } - /** - * @return the name of player 2's preferred stroke. - */ + /** @return the name of player 2's preferred stroke. */ public String getMostUsedStrokePlayer2() { return maxStrokeFor(Point.PLAYER2); } diff --git a/src/Q8/Point.java b/src/Q8/Point.java index 391ea28..2917d22 100644 --- a/src/Q8/Point.java +++ b/src/Q8/Point.java @@ -28,23 +28,17 @@ public class Point { this.score = score; } - /** - * @return the player that scored the point. - */ + /** @return the player that scored the point. */ public int getPlayer() { return this.player; } - /** - * @return the score for the player at the time the point was scored. - */ + /** @return the score for the player at the time the point was scored. */ public int getScore() { return this.score; } - /** - * @return the stroke used to score the point. - */ + /** @return the stroke used to score the point. */ public String getStroke() { switch (this.stroke) { case "a": diff --git a/src/Q8/README.md b/src/Q8/README.md index c485eaa..3ed18a1 100644 --- a/src/Q8/README.md +++ b/src/Q8/README.md @@ -44,5 +44,22 @@ with additional methods for calculating the preferred strokes for each player. 1. Errors and Warnings + + This program does not accept user input. + 1. Sample Input and Output + + The output from running the program. + + ```bash + $ java -cp target/assignment2*.jar ca.mokhan.comp268.App 8 + === Question 8 === + Player 1 points: 5 + Player 2 points: 21 + Player 1 streak: 2 + Player 2 streak: 9 + Player 1 favourite stroke: smash + Player 2 favourite stroke: net-shot + ``` + 1. Discussion |
