-
Notifications
You must be signed in to change notification settings - Fork 1
/
SpellWord.java
44 lines (37 loc) · 871 Bytes
/
SpellWord.java
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
/**
* class represents a HangmanWord that is a spell
*
*/
public class SpellWord extends HangmanWord {
private String description;
/**
* Parameterized constructor that initializes the word (spell) and its description
* @param a word
* @param d description
*/
public SpellWord(String a, String d) {
super(a);
description = d;
}
/**
* returns hint (description of spell)
* @return hint
*/
public String getHint(){
return description;
}
/**
* returns won message with the name of spell
* @return won message
*/
public String getWonMessage() {
return "YOU WON!!!! The spell "+this.getWord(this.getLength()-1)+" was cast.";
}
/**
* returns lost message with name of spell
* @return lost message
*/
public String getLostMessage() {
return "YOU LOST!!!! The spell was "+ this.getWord(this.getLength()-1)+".";
}
}