Skip to main content

Grade 12 · 18 weeks

Computer Science

Build and test a Lantern Festival scorer, model data, and design a program that people can use without giving up unnecessary personal information.

Start Week 4

Term 1 · Algorithms, programs and testing

Variables, decisions and boundaries

A variable holds a value. A conditional selects behavior based on a test. A boundary case such as equality can reveal whether the implementation matches the requirement.

Read-aloud is not available in this browser. You can still read this text on screen.

Computing lab

Predict the result for scores 9, 10 and 11, then run the starter. Make the threshold configurable and compare an if/else version with an early-return version for the same cases.

Keep for review. Boundary tests and a short explanation of which version is easier to read and why.

JavaScript starter code

Save this example as a .js file and run it in Node.js or an editor your educator approves.

function gateStatus(score) {
  if (score >= 10) return 'Open';
  return 'Closed';
}
for (const score of [9, 10, 11]) {
  console.log(score, gateStatus(score));
}
Which condition includes the boundary of 10 in a minimum-score rule?
Plan the week
  1. Read the lesson and explain its main idea in your own words.
  2. State the system or program’s goal and sketch its inputs, rules and output.
  3. Complete the investigation and keep the evidence listed above.
  4. Test or trace a second case and record any change it suggests.
  5. Answer the week’s check, then explain your reasoning using your evidence.

Keep your practice projects local or share them with an approved reviewer. Use fictional or nonpersonal data in your programs and tests.

Academy curriculum for family use. Course credit is subject to school and educator approval.

Quest progressProgress recorded