-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThinkDrink.java
173 lines (161 loc) · 5.26 KB
/
ThinkDrink.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/**
* App for BaseHacks
*
* @author Sona Dolasia
* @version 06/11/2016
*/
import java.util.ArrayList;
public class ThinkDrink
{
public String name;
public double weight;
public double height;
public double caffeineLimit;
public double hw;
public String exercise;
public double level;
public int water;
public int sugar;
public int caffeine;
public int sportDrink;
public int sweetDrink;
public int coffee;
public int decafCoffee;
public int tea;
public int decafTea;
public int sweetened;
public int temperature;
public int goalOther;
public int actualWater;
public int actualOther;
//inches
public ThinkDrink (String n, double w, double h)
{
name = n;
weight = w;
height = h;
sportDrink = 0;
sweetDrink = 0;
coffee = 0;
decafCoffee = 0;
tea = 0;
decafTea = 0;
sweetened = 0;
goalOther = 0;
actualWater = 0;
actualOther = 0;
}
public void calcCaffeineLimit()
{
double factor = height + weight;
caffeineLimit = 400 + (factor - 216);
}
public double getCaffeineLimit()
{
return caffeineLimit;
}
public String whatDrink ()
{
// work left in the day
if(hw >= 1 && hw <= 2)
{
coffee += 3;
decafCoffee +=2;
}
if(hw > 2 && hw <= 3)
{
tea += 2;
decafTea += 1;
}
if (hw > 3)
{
tea += 3;
decafTea += 2;
}
// exercise so far
if(exercise.toLowerCase().equals("yes"))
{
sportDrink += 5;
}
// exhaustion/stress level
if(level >= 4)
{
sweetDrink += 3;
sweetened += 1;
}
// water
if(water <= 4)
{
tea += 2;
decafTea +=2;
coffee -= 1;
decafCoffee -= 1;
}
if(water > 4 && water < 8)
{
tea += 1;
decafTea += 1;
}
// sweetDrinks
if(sugar >= 1)
{
sweetDrink = -1;
sportDrink -= 3;
sweetened = -1;
}
// caffeiene
if(caffeine >= caffeineLimit - 100)
{
coffee = -1;
}
if(caffeine >= caffeineLimit)
{
tea = -1;
}
int[] drinks = {sportDrink, sweetDrink, coffee, decafCoffee, tea, decafTea};
String[] alsoDrinks = {"WOW you've been working out! Get it! Werk that New Years Resolution. Make sure to re-hydrate and get a sports drink like Gatorade, Vitamin Water, or a fruit smoothie. A sports drink will also help to replenish your electrolytes!",
"You get a swet drink! TREAT YO SELF! Get that milkshake, bring all them boys to the yard! Something like a milkshake or a hot chocolate will perk you up. And stay hydrated!",
"Get ready to WERK. You have a lot to get done, so you need some major caffeine. Go get a cup of coffee and get ready to werk, werk, werk, werk, werk. And stay hydrated!",
"Y I K E S - you need to lay off the caffeine… but that’s okay! You can still enjoy your favorite Starbucks drink, just get decaf! And stay hydrated!",
"Do you hate the taste of coffee? Does it taste as bitter as your ex? Perfect, you can still get the caffeine you need with a nice big cup of tea!",
"Sip on some decaf tea to calm yourself down, whether you have a night of studying or High School Musical, decaf tea is perfect for the occasion."};
int max = drinks[0];
ArrayList<Integer> maximum = new ArrayList<Integer>();
for(int i = 1; i < drinks.length; i++)
{
if(drinks[i] > max)
{
max = drinks[i];
}
}
for(int j = 0; j < drinks.length; j++)
{
if(drinks[j] == max)
{
maximum.add(j);
}
}
int value = (int)(Math.random()*maximum.size());
if(sweetened == 1 && maximum.get(value) >= 2 && temperature >= 78)
{
return "Drink water and... " + alsoDrinks[maximum.get(value)] +
" **Spice up your life! Or rather, sweeten up your life! Throw a pack or two of sugar in your drink! You deserve it. ;)"
+ " **Damn it's hotter than Beyonce out there. Fee free to get yourself a version of this drink as cold as the shade the queen herself throws. ;)";
}
else if(sweetened == 1 && maximum.get(value) >= 2)
{
return "Drink water and... " + alsoDrinks[maximum.get(value)] +
" **Spice up your life! Or rather, sweeten up your life! Throw a pack or two of sugar in your drink! You deserve it. ;)";
}
else if(temperature >= 78 && maximum.get(value) >= 2)
{
return "Drink water and... " + alsoDrinks[maximum.get(value)] +
" **Damn it's hotter than Beyonce out there. Fee free to get yourself a version of this drink as cold as the shade the queen herself throws. ;)";
}
return "Drink water and... " + alsoDrinks[maximum.get(value)];
}
public void addtoGoalOther()
{
goalOther += 1;
}
}