Type the parameterized Bell: rings stored in the ctor, looped in action
Type the parameterized Bell: rings stored in the ctor, looped in action
Answer
public class Bell extends Event { private int rings; public Bell(long delayTime, int rings) { super(delayTime); this.rings = rings; } public void action() { for (int i = 0; i < rings; i++) System.out.println("Bing!"); } }
The event file line "Event=Bell,time=9000,rings=5" drives this: the parser passes rings to the ctor; action() rings that many times. The framework grew by ONE new field + a loop.