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