Skip to main content

Checkpoint: build the Sensor class

Challenge on lesson: Checkpoint: class design

CHALLENGE
Difficulty: beginner+25 XP

Rewrite the whole Sensor class from its spec table: new Sensor(start) stores the starting value; read() returns it; tick() adds 1 and returns nothing. State must persist across calls — three ticks after starting at 10 must read 13.

Back to lesson: Checkpoint: class design