2. Sensor Class

Your task is to define a class named Sensor with one method:

  • int read() that returns the fixed value 100
     

The program will create a Sensor object, call read(), and print:

Sensor reading: <value>


Example

Output:

Sensor reading: 100


Why this output?

read() always returns 100, so the printed line shows that exact value.


Question Significance

This reinforces “class with one responsibility”—a clean API that hides details and exposes just what the caller needs.

Loading...

Input

Expected Output

Sensor reading: 100