The Classroom Water Budget

Grade 4 Scratch 3.0 Simulation first Tracking Intake vs Target
Simulation lab
Tool: Scratch 3.0
Open Scratch ↗
Simulator preview

Follow instruction sequences to guide the character to the goal.

📁 Tools ▴
  • Web browser (Chrome, Edge, Firefox)
  • Internet connection
  • Scratch 3.0 online editor

🔧 Build Your Classroom Water Budget

1 Initialize 'daily_budget_liters' to 200 and 'total_consumed_liters' to 0.
2 Program the Cup Dispenser key (Space) to add 0.5 Liters per cup to total consumption.
3 Calculate remaining water continuously: 'water_remaining = daily_budget - total_consumed'.
4 Trigger a conservation alert when water remaining drops below 30 Liters!
🧩 Block plan / Starter code ▴
when [green flag] clicked
set [daily_budget v] to [200]
set [total_consumed v] to [0]
set [water_remaining v] to (daily_budget)
say [Classroom Water Station Ready: 200L Available]

when [space v] key pressed // Pupil drinks 1 cup (0.5L)
change [total_consumed v] by (0.5)
set [water_remaining v] to ((daily_budget) - (total_consumed))
say (join [Cup dispensed! Remaining: ] (join (water_remaining) [ Liters]))
if <(water_remaining) <= [30]> then
    say [CAUTION: Water budget low! Drink mindfully.]
    play sound [Alert v]
end

Calculating remaining water dynamically prevents over-consumption and tank depletion.

⚗️ Test your model

Test Condition / ActionExpected Result
Dispense 1 cuptotal_consumed = 0.5L, water_remaining = 199.5L
Dispense 10 cupstotal_consumed = 5.0L, water_remaining = 195.0L
Water reaches 30LConservation warning activates; alert chime sounds
⚑ Try a challenge

Calculate the average hourly consumption rate and predict what time the tank will run dry!

❓ Quick check
What Scratch block prompts the pupil with a question and waits for them to type a number using the keyboard?

📖 Our Story & Concepts

During dry season, many schools receive a fixed delivery of clean water each morning. If students drink without tracking, the tank empties before afternoon lessons, leaving everyone thirsty during sports.

Resource budgeting in computer science involves comparing continuous consumption against fixed quotas. By tracking rates and thresholds, digital systems help communities manage electricity, fuel, water, and internet data sustainably.

</> Full Annotated Code Walkthrough

// Complete Water Budget with Hourly Pacing Monitor
when [green flag] clicked
set [daily_budget v] to [200]
set [total_consumed v] to [0]
set [water_remaining v] to [200]
set [cup_count v] to [0]

when [space v] key pressed
if <(water_remaining) >= [0.5]> then
    change [cup_count v] by (1)
    change [total_consumed v] by (0.5)
    set [water_remaining v] to ((daily_budget) - (total_consumed))
    play sound [Drip v]
    say (join [Cups: ] (join (cup_count) (join [ | Left: ] (join (water_remaining) [L]))))
else
    say [TANK EMPTY! Please refill dispenser.]
    play sound [Buzzer v]
end

Calculating remaining water dynamically prevents over-consumption and tank depletion.

▷ Expected Results & Troubleshooting

Test Condition / ActionExpected Result
Dispense 1 cuptotal_consumed = 0.5L, water_remaining = 199.5L
Dispense 10 cupstotal_consumed = 5.0L, water_remaining = 195.0L
Water reaches 30LConservation warning activates; alert chime sounds

⚑ Extension Challenges & Blueprints

⚑ Extension Challenges
  • Level 1: Add a Jerrycan button (J key) that dispenses 20 Liters at once.
  • Level 2: Display a visual progress bar that shrinks as water is consumed.
  • Level 3: Add a refill key with password protection that resets the budget to 200L.

❓ Check Your Understanding

Question 1: What Scratch block prompts the pupil with a question and waits for them to type a number using the keyboard?

Question 2: If the class has currently logged 32 cups, and a pupil logs 3 cups, what code updates the running total?

Question 3: Why is 'set variable to (answer)' a mistake when building an accumulator total?

Question 4: What condition checks whether the class has met or surpassed their daily target of 50 cups?

Feedback appears after you check your answer.