Big Idea 3 · Topic 3.6 · Exercise 2
Write the Rule
25 minutes - 5 decisions - choose IF or IF-ELSE, write it, and spot the bug
Back to the Topic 3.6 lessonAll CSP topics
How this page works
The writing boxes below are yours. What you type stays in this browser, is saved here as you go, and is never sent to us or to your teacher. Hand the written work in the way your teacher asked for it.
The graded check at the bottom is the part that records to your teacher's gradebook.
The cases, from your handoutNot recorded
The same cases as your handout, in the same order.
Scenario 1 · Foundational
The app should display 'Free water station ahead' ONLY when the temperature is at least 90 degrees. On cooler days it should show nothing extra.
Condition (a Boolean expression using a relational operator):
Construct (plain IF or IF-ELSE) + the conditional written in pseudocode:
Enrichment - a boundary case or an equivalent way to write it:
Scenario 2 · Core
At checkout the app must label every order: 'Free shipping' when the cart total is at least 35 dollars, and 'Add $4 shipping' otherwise. Every order gets exactly one label.
Condition (a Boolean expression using a relational operator):
Construct (plain IF or IF-ELSE) + the conditional written in pseudocode:
Enrichment - a boundary case or an equivalent way to write it:
Scenario 3 · Core
SPOT THE BUG. A developer wanted every rider to get a message, but wrote: IF(height >= 48){ DISPLAY("Board the ride") }. Testers report that short riders see nothing. Diagnose and fix it.
Condition (a Boolean expression using a relational operator):
Construct (plain IF or IF-ELSE) + the conditional written in pseudocode:
Enrichment - a boundary case or an equivalent way to write it:
Scenario 4 · Challenge
A locker is FREE when the number of items is 0, and costs money otherwise. The app must show 'Free locker' when count = 0 and 'Locker fee applies' otherwise.
Condition (a Boolean expression using a relational operator):
Construct (plain IF or IF-ELSE) + the conditional written in pseudocode:
Enrichment - a boundary case or an equivalent way to write it:
Scenario 5 · Challenge
SPOT THE BUG. This should print 'Adult' for age 18 and up: IF(age > 18){ DISPLAY("Adult") } ELSE { DISPLAY("Minor") }. A tester enters 18 and gets 'Minor'. Diagnose and fix it.
Condition (a Boolean expression using a relational operator):
Construct (plain IF or IF-ELSE) + the conditional written in pseudocode:
Enrichment - a boundary case or an equivalent way to write it:
No graded check on this page yetNot recorded
About the line in your handout
Your handout says this exercise is available online and auto-graded. The exercise IS here, and it is the same work in the same order, but the auto-graded half is not written for this topic yet. Nothing on this page is scored or sent to your teacher.
Hand this in the way your teacher asked for it. Topic 1.1 has its graded check today, and the rest follow.