0% found this document useful (0 votes)
585 views3 pages

Activity Guide - Conditionals Make - Unit 4 Lesson 8

The document provides instructions for a group project to create an app that calculates ticket prices based on different conditions. It includes 4 steps: 1) Try out sample inputs, 2) Plan the variables and conditional logic, 3) Write the code, and 4) Submit. The group is asked to create variables to store day, age, discount code, and price. They must then use conditional logic like if/else statements to determine the price based on rules for weekends, weekdays, ages, and a discount code. Flowcharts and pseudocode are used to plan the logic before writing the code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
585 views3 pages

Activity Guide - Conditionals Make - Unit 4 Lesson 8

The document provides instructions for a group project to create an app that calculates ticket prices based on different conditions. It includes 4 steps: 1) Try out sample inputs, 2) Plan the variables and conditional logic, 3) Write the code, and 4) Submit. The group is asked to create variables to store day, age, discount code, and price. They must then use conditional logic like if/else statements to determine the price based on rules for weekends, weekdays, ages, and a discount code. Flowcharts and pseudocode are used to plan the logic before writing the code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 4 Lesson 8

Name(s)___Amanda, Aisha, Danita, and Katarina ________________________________________________

Activity Guide - Conditionals Make - 20 point project


Step 1 - Try the app
Try making tickets for different combinations of inputs.
● Make a ticket for a weekend.
● Make a ticket for a weekday (Monday - Friday) and someone 18 or
younger.
● Try the discount code "FREEFRIDAY" on a Friday.

Write the names of your partners (you need at least 1, max 3):
Discuss with a Partner(s)
● What variables would you need to program this app?
● 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

Day The day of the week.

Age The age of the ticket buyer.

Discount code It stores the discount code the user inputs.

Price The cost of the ticket.

Conditionals: Draw a flowchart or create pseudocode 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

18 Monday none $5

18 Saturday none $10

50 Monday none $10

50 Saturday none $10

18 Tuesday FREEFRIDAY $5

50 Friday FREEFRIDAY $0

18 Friday FREE $5

50 Friday FREE $10

Computer Science Principles 1


Unit 4 Lesson 8

Create your pseudocode/flowchart here. You are welcome to copy a picture of written work.

We are supposed to add comments to the app


In the console log???

Step 3 - Write Your Code


● Write the code for the app, using your plan above and the comments provided in Code Studio to help
● Step You Can Follow
○ Create all the variables from your table above.
○ Give your variables a starting value using the assignment operator (=)
○ Create an event handler (onEvent) for the "calculate_button"
○ Inside the event handler start writing code for your conditional using your flowchart
○ Test your code as you go using the table below. At the end it should work for every combination of
outputs in the table on the first page.
○ Use your debugging skills to identify unexpected behavior and fix your program
○ Comment your code as you go, explaining what each event handler does
● Check the Help & Tips tab for ideas about Programming Patterns you can use
● Extension Ideas
○ Add another discount code for a different day of the week or age range
○ Make guests 65 and older always pay $5 unless they use a discount code

Step 4 - Submit
There is no retake opportunity for this project. Before you submit, check the rubric below to make sure your program
meets the requirements of the task.

Computer Science Principles 2


Unit 4 Lesson 8

Category Extensive Convincing Limited Evidence-1 No Evidence-0


Evidence-3 Evidence-2

Pseudocode/flowcha Flowchart/pseudoco Flowchart/pseudoco Flowchart/pseudoco No


rt de indicates that the de is indicates that de is missing key flowchart/psuedocde
app was thoroughly the app was planned logic
planned

Input onEvents are onEvents are onEvents are onEvents are not
created for all the created for most of created for some of created for any
required inputs. the inputs. the inputs. inputs.

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 One or two errors Three or four errors More than four errors
errors. present in the are present in the are present in the are present in the
required code. 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 of all of most onEvents function of some
onEvents and and conditional logic. onEvents and
conditional logic. conditional logic.

Computer Science Principles 3

You might also like