Commit a7abfd9

mo khan <mo@mokhan.ca>
2019-08-11 23:38:24
add documentation and complete program profile
1 parent a04f5ec
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);
   }
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);
   }
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":
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