Exercise 2 - When-Equation

1 When-Equation

Write a class LightSwitch, that is initially off and switched on at time 5.



1.1 Tip

sample(start, interval) returns true and triggers time events at time instants and rem(x, y) returns the integer remainder of x/y, such that div(x,y) * y + rem(x, y) = x.


1.2

1.2.1 LightSwitch


1.2.2 Simulation of LightSwitch