Events & Keyboard Input
3 min read
Events & Keyboard Input
A calculator should not care whether a user clicked a button or pressed a key.
In this module, you will make the event layer translate different forms of user input into the same calculator actions.
The important pattern is:
Input source → action → calculator method → state → display
That keeps the calculator logic reusable instead of creating separate calculation code for the mouse and keyboard.