In this scenario, you're working on an app called Health Check, and
what HealthCheck is is basically an app that administers a quiz, and
that quiz can tell the person who's using it how healthily they're living.
The questions appear in this box here, and the user can answer either Yes,
Sometimes, or No, and let's say there's about 100 different questions, and
they range from things like, do you exercise more than three times a week?
Do you drink less than two caffeinated drinks a day?
Or, do you have a supportive social network?
Now, the questions are phrased in such a way that when you say Yes, that always
means you're more healthy and when you say No, it means you're less healthy.
Sometimes is sort of an inconclusive answer.
And what the app is doing is really keeping track of a score.
When you hit Yes, it adds 1 to the health level.
When you answer Sometimes, it remains unchanged, and
when you answer No, it subtracts 1 from the health level.
Also, once you've selected one of these options,
it'll show you a summary of what you just answered and
what your current health level is before giving you the next question.
We're just going to look at the interaction between clicking one of
these buttons and showing the summary of where you're at right here.
Let's look at the code.
Okay, so here's the code, and I've also provided it in the instructor notes,
if you want to take a look at the sort of text version of this.
Again, it's not the complete code.
These little ellipses here mean that there's code before and
after the methods that you're shown here.
So how does this work?
Well,.when you hit the Yes button, the yes method is called.
This increases the healthLevel, makes a message, and then displays that message.
Similarly, when you hit the Sometimes button, the sometimes method is called.
The only difference here is that instead of adding 1, you add 0,
which means that the variable value doesn't really change.
And the format is similar when you hit the No button.
The no message is called, 1 is subtracted from the healthLevel and
a message is printed.
Okay, we have two variables in this program, healthLevel and message.
Let's look at message first.
So my first question to you is,
from the code that you see here, is message a local or global variable?