Computer Science with Mr. Yongpradit Springbrook High School

Concussion App
Objectives:
1. Explain how sequence, selection, and
iteration are building blocks of
algorithms
2. Create equations with two or more
variables to represent relationships
among quantities.
Warm-Up
C = 3V + 3B + 2D + 2M
1. Solve for C given the following variable values:
a) V = 7
B=4
D=8
M=6
b) V = 9
B=8
D=7
M=4
2. Describe the relationship between variables V, B, D, & M.
a) Do they all affect C equally?
b) How does V affect C?
c) How does V’s effect on C compare to B’s?
d) How does V’s effect on C compare to M’s?
Concussion Factors
What factors go into diagnosing a concussion?
http://www.youtube.com/watch?v=k1qvcw-zqtQ
Concussion Symptoms
•
•
•
•
Vomiting/Nausea
Balance problems/clumsy
Drowsy/dazed
Memory loss before and after event
Who should be able to play?
Person 1
Person 2
Person 3
Vomit: Spit
Balance: Slightly off-
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
balance
Drowsy: active,
wants to play, eyes
slightly closed
Memory:
remembers
everything, but slow
response
Who should be able to play?
Person 1
Person 2
Person 3
Vomit: Spit
Balance: Slightly off-
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
How do we compute
balance
a rating (0 to 100) for
Drowsy: active,
wants to play, eyes
each person?
slightly closed
Memory:
remembers
everything, but slow
response
Who should be able to play?
Person 1
Person 2
Person 3
Vomit: Spit
Balance: Slightly off-
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
balance
Drowsy: active,
wants to play, eyes
slightly closed
Memory:
We need
numbers!
remembers
everything, but slow
response
Computing a Problem
1. Identify Factors: Variables
2. Quantify: Numbers & Units
3. Express the Relationship: Equation
4. Algorithm: How my mind does it
5. Coded Algorithm: How computer does it
We need to Quantify!
Person 1
Person 2
Person 3
Vomit: 2
Balance: 6
Drowsy: 5
Memory: 6
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
Rate the factors on a
scale from 0-10.
0 = best 10 = worst
We need to Quantify!
Person 1
Person 2
Person 3
Vomit: 2
Balance: 6
Drowsy: 5
Memory: 6
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
But how do you
rate vomit?
Selection
If vomit >= 300 Then
vomit = 10
ElseIf vomit >= 250 Then
vomit = 9
Etc…
Who should be able to play?
Person 1
Person 2
Person 3
Vomit: Spit
Balance: Slightly off-
Vomit: None
Balance: ok
Drowsy: tired,
wants to rest
Memory:
remembers before
and hazy about
after
Vomit: Chunks
Balance: needs to
lean on chair
Drowsy: Wants to
close eyes
Memory: Slow to
respond
Do
all
the
factors
have
balance
Drowsy: active,
the
same
importance?
wants to play, eyes
slightly closed
Memory:
remembers
everything, but slow
response
Priority
• Put the four factors in order from most to
least significant.
Vomit, Balance, Drowsy, Memory
1. _________________ (most important)
2. _________________
3. _________________
4. _________________ (least important)
Weighting the Priorities
• You have a total of 10 weights to use. Allocate
the weights based on priority.
1. Memory
2. Balance
3. Vomit
4. Drowsy
x 3
x 3
x 2
x ____
2
10
Adds up to 10
Equation to Rate Concussion
0 to 10
Memory:
Balance:
Vomit:
Drowsy:
Weight
Total
____ x ____ = ____
+
____ x ____ = ____
+
____ x ____ = ____
+
____ x ____ = ____
Rating: _________
Sample Calculation
0 to 10
Memory:
Balance:
9
6
Weight
Total
x 2=
18
x 2=
Vomit:
7
x 4=
Drowsy:
5
x 2=
+
+
+
12
28
10
Rating: 68
Sequence
TextWindow.WriteLine(“How much vomit?")
vomit = TextWindow.Read()
VS.
vomit = TextWindow.Read()
TextWindow.WriteLine(“How much vomit?")
Selection
If repeat = "y" Then
Goto Start
EndIf
Checks if the user
types in “y”
Iteration
If repeat = "y" Then
Goto Start
EndIf
Checks if the user
Goes back to types in “y”
beginning and
repeats program
‘top of program code
Start:
GraphicsWindow.Draw...
Exit Card
1. Write down the equation you used to rate a
concussion.
2. Write example sets of inputs for two athletes
and calculate the rating.
3. Describe the relationship between the input
variables.
a) How does each affect the rating?
b) Compare one variable’s effect to another.