-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSituation.java
71 lines (65 loc) · 1.73 KB
/
Situation.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* The Situation class creates an object that holds a situational question and
* the two options that go with the question. The class allows for manipulation
* of the question and options. A situation object was designed specifically for
* implementation in a binary tree of Situation objects in that the selection
* of an Option object will lead to one of two other Situation objects.
*
* @author Zahra Thabet
* @author Giulia Bronzi
* @version 12.17.18
*/
public class Situation
{
String question; //question that user is prompted with
//Option in response to the question that leads to left in a binary tree
Option optionLeft;
//Option in response to the question that leads to right in a binary tree.
Option optionRight;
/**
* Constructor for objects of class Situation.
*
* @param q
* @param oL
* @param oR
*/
public Situation(String q, Option oL, Option oR)
{
question = q;
optionLeft = oL;
optionRight = oR;
}
/**
* Gets the question
*
* @return question
*/
public String getQuestion(){
return question;
}
/**
* Gets the left-pointing option
*
* @return optionLeft
*/
public Option getOptionLeft(){
return optionLeft;
}
/**
* Gets the right-pointing option
*
* @return optionRight
*/
public Option getOptionRight(){
return optionRight;
}
/**
* Gets a String representation of the Situation object
*
* @return String of the Situation object
*/
public String toString(){
return question + " Choice 1: " + optionLeft + " Choice 2: " +
optionRight;
}
}