-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
51 lines (41 loc) · 1.06 KB
/
Copy pathPlayer.java
File metadata and controls
51 lines (41 loc) · 1.06 KB
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
/**
* This is the class for players in blackjack.
* @author Crishna Iyengar
* @version 1.0
*/
public class Player {
private int playerScore;
private int[] playerCards = new int[7];
private int cardCount;
/**
* This constructor makes a player object.
* Two instance variables: player score and their hand
*/
public Player() {
this.playerScore = playerScore;
this.playerCards = playerCards;
}
/**
* This method takes in a cardval and adds it to the score.
* @param cardVal the value of a drawn card
*/
public void setPlayerScore(int cardVal) {
this.playerScore = this.playerScore + cardVal;
this.playerCards[cardCount] = cardVal;
cardCount++;
}
/**
* This method returns the player's score.
* @return the player's score
*/
public int getPlayerScore() {
return this.playerScore;
}
/**
* This method returns the player's Cards
* @return playerCards
*/
public int[] getPlayerCards() {
return this.playerCards;
}
}