-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolution.java
67 lines (46 loc) · 1.24 KB
/
Solution.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
import java.util.ArrayList;
public class Solution {
private ArrayList<Item> included;
private double maxProtein;
private int finalCalCount;
public ArrayList<Item> getIncluded() {
return included;
}
public void setIncluded(ArrayList<Item> included) {
this.included = included;
}
public Solution(){
included = new ArrayList<Item>();
setMaxProtein(0.0);
setFinalCalCount(0);
}
public Solution(ArrayList<Item> a, double m, int c){
included = a;
setMaxProtein(m);
setFinalCalCount(c);
}
public Solution(double m, int c) {
included = new ArrayList<Item>();
setMaxProtein(m);
setFinalCalCount(c);
}
public String toString(){
String x = "";
for(Item a : included)
x += a.getName() + " (" + a.getCalories() + " calories and " + a.getProtein() + "g of protein)\n";
String endSentence = "For a total of " + this.getMaxProtein() + "g in " + this.getFinalCalCount() + " calories";
return x + endSentence;
}
public double getMaxProtein() {
return maxProtein;
}
public void setMaxProtein(double maxProtein) {
this.maxProtein = maxProtein;
}
public int getFinalCalCount() {
return finalCalCount;
}
public void setFinalCalCount(int finalCalCount) {
this.finalCalCount = finalCalCount;
}
}