master
 1/**
 2 * Assignment 2, COMP268 Class: Point.java
 3 *
 4 * @description A class used to represent a point for a single round.
 5 * @author: mo khan Student ID: 3431709
 6 * @date August 3, 2019
 7 * @version 1.0
 8 */
 9package Q8;
10
11public class Point {
12  public static final int PLAYER1 = 0;
13  public static final int PLAYER2 = 1;
14  private int player;
15  private int score;
16  private String stroke;
17
18  /**
19   * Creates an instance of a Point.
20   *
21   * @param player the numeric identifer to identify the player that received the point.
22   * @param stroke the name of the stroke that was used to score the point.
23   * @param score the current score for the player who earned the point.
24   */
25  public Point(int player, String stroke, int score) {
26    this.player = player;
27    this.stroke = stroke;
28    this.score = score;
29  }
30
31  /** @return the player that scored the point. */
32  public int getPlayer() {
33    return this.player;
34  }
35
36  /** @return the score for the player at the time the point was scored. */
37  public int getScore() {
38    return this.score;
39  }
40
41  /** @return the stroke used to score the point. */
42  public String getStroke() {
43    switch (this.stroke) {
44      case "a":
45        return "slice";
46      case "b":
47        return "drive";
48      case "c":
49        return "smash";
50      case "d":
51        return "drop";
52      case "e":
53        return "net-shot";
54      default:
55        return "unknown";
56    }
57  }
58}