-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
51 lines (39 loc) · 942 Bytes
/
Player.java
File metadata and controls
51 lines (39 loc) · 942 Bytes
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
public class Player{//player class
private int numGuesses;//initalize varialbes
private char letterGuess;
private String wordGuess;
Player(){//Constructor
numGuesses=15;
letterGuess=' ';
wordGuess= " ";
}
public int getNumGuesses() {//get the number of gueses
return numGuesses;
}
public String getWordGuess() {//get the word guessed
return wordGuess;
}
public void setWordGuess(String w) {//set the word guessed
wordGuess = w;
}
public void setNumGuesses(String t) {//set num guesses depending on difficulty
if(t.equals("Easy")){
numGuesses = 15;
}
else if(t.equals("Normal")){
numGuesses = 12;
}
else if(t.equals("Hard")){
numGuesses = 10;
}
}
public char getLetterGuess() {//get the letter guesses
return letterGuess;
}
public void setLetterGuess(char l) {//set the letter guessed
letterGuess = l;
}
public void minusNumGuess(){//minus the number of guesses
numGuesses-=1;
}
}