-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOption.java
100 lines (91 loc) · 2.64 KB
/
Option.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* Creates an Option object that stores a decision and its corresponding impact
* on a person's sleep, smart, and social scores. The decision is a string
* answer to a question. The Option object was designed to be stored along with
* a corresponding question in a Situation object.
*
* @author Giulia Bronzi
* @author Zahra Thabet
* @version 12.17.18
*/
public class Option
{
private String decision;
private int[] points;
/**
* Constructor for objects of class Option that takes its points as a
* parameter of an array of points.
*
* @param dec the decision text
* @param pts the points to be added
*/
public Option(String dec, int[] pts)
{
if(pts.length==3){
decision = dec;
points = pts;
}else{
throw new IllegalArgumentException("The length of the inputted "+
"array of points is not 3 "+
"which it must be for an Option"
+" object.");
}
}
/**
* Constructor for objects of class Option. Allows for it's points to be
* entered as individual integers rather than an array of integers.
*
* @param dec the decision text
* @param sleep the sleep points of the Option object
* @param smart the smart points of the Option object
* @param social the social points of the Option object
*/
public Option(String dec, int sleep, int smart, int social){
decision=dec;
points = new int[3];
points[0]=sleep;
points[1]=smart;
points[2]=social;
}
/**
* Gets the decision
*
* @return decision
*/
public String getDecision(){
return decision;
}
/**
* Gets an array of the points of the Option object.
*
* @return an array of the points of the Option object.
*/
public int[] getPoints(){
return points;
}
/**
* Sets the decision of the Option object.
*
* @param d the new decision String
*/
public void setDecision(String d){
decision = d;
}
/**
* Sets the points
*
* @param p an array of the points to be assigned
*/
public void setPoints(int[] p){
points = p;
}
/**
* Gets a String representation of the Option object.
*
* @return a String of the Option object
*/
public String toString(){
return "Decision: " + decision + "Sleep: " + points[0] + " Smart: "+
points[1] + " Social: " + points[2];
}
}