Activity Guide - Conditionals Make - Unit 4 Lesson 8
Activity Guide - Conditionals Make - Unit 4 Lesson 8
ut"
● Where does this app use conditionals (if-statements)?
Step 2 - Plan
Variables: Fill in the table below for each variable you'll need to create.
Variable Name What the Variable Stores
Conditionals: Draw a flowchart that follows the rules below. There's more than one way to do it. Use the table to make
sure that your flowchart works for different combinations of age, day, and discount code.
● On the weekends ("Saturday" and "Sunday") everyone pays full price of $10
● On weekdays (Monday through Friday) if you are 18 years or younger you pay $5.
● If you use the discount code "FREEFRIDAY" on a Friday you get in for $0. No other discount codes will work
and the code only works on Fridays.
Age Day Discount Code Price If discount == “FREEFRIDAY” && day == “Friday”
18 Monday none $5
18 Saturday none $10
50 Monday none $10
50 Saturday none $10 True False
price = 0 age <= 18 && day != "Saturday") && day !=
18 Tuesday FREEFRIDAY $5
"Sunday"
50 Friday FREEFRIDAY $0
18 Friday FREE $5
50 Friday FREE $10 True False
price == price/2 price = 10
Step 4 - Submit
Before you submit, check the rubric below to make sure your program meets the requirements of the task.
Input onEvents are created onEvents are created onEvents are created onEvents are not
for all the required for most of the for some of the created for any
inputs. inputs. inputs. inputs.
Storage: Variables Variables are created Most information is Some information is There are no
and appropriately stored in a variable stored in a variable variables which store
used for all pieces of and appropriately and appropriately the necessary
information used in updated throughout updated throughout information for the
the app. the app. the app. app to work correctly.
Processing: The code correctly The code correctly The code correctly The code does not
Conditional Logic determines the price determines the price determines the price correctly determine
for all combinations for most but not all for some but not all the price for any
of inputs (age, price, combinations of combinations of combination of inputs
discount code). inputs (age, price, inputs (age, price, (age, price, discount
discount code). discount code). code).
Code: Output The screen correctly The screen displays The screen displays The screen does not
displays the day, most but not all some but not all correctly display any
age, and price of the information correctly information correctly information in the
ticket. in the ticket. in the ticket. ticket.
Code runs without No errors are present On or two errors are Three or four errors More than four errors
errors. in the required code. present in the are present in the are present in the
required code. required code. required code.
Coding Comments Comments are used Comments are used Comments are used Comments are not
to correctly explain to explain the to explain the present.
the purpose and purpose and function purpose and function
function of all of most onEvents of some onEvents
onEvents and and conditional logic. and conditional logic.
conditional logic.