1. LED Class

Your task is to define a class named LED with two methods:

  • void turnOn() prints LED ON
  • void turnOff() prints LED OFF

The program will create an LED object and call these methods in order.


Example

Output:

LED ON
LED OFF

Why this output?

turnOn() prints LED ON, then turnOff() prints LED OFF, each on its own line.


Question Significance

This builds the habit of encapsulating behavior in a class with clearly named methods—exactly how firmware modules (like GPIO control) are wrapped for safe, readable use.

Loading...

Input

Expected Output

LED ON LED OFF