Create a class SensorConfig that represents configuration data for a digital sensor in an embedded system.
Each sensor must be initialized with valid configuration data at startup, specifically a sensor ID and a calibration offset. The system must not allow uninitialized sensor objects.
The class must store the latest calibrated sensor value and update it whenever new raw data is received.
Class Requirements
The class SensorConfig must contain the following private data members:
int id — unique sensor identifierint offset — calibration offset applied to raw readingsint lastValue — last calibrated value (must be initialized to 0)Constructor Requirements
The class must define only one constructor:
SensorConfig(int sensorId, int calibrationOffset)
The constructor must:
sensorId to idcalibrationOffset to offsetlastValue to 0❗ A default constructor must not be used.
Public Member Functions
void update(int raw)lastValue = raw + offset
int read()lastValueMain Function Behavior
In main():
id and offsetSensorConfig object using the parameterized constructorr1 and r2update(r1) followed by update(r2)read()Input Format
id offset
r1 r2
Output Format
<final_calibrated_value>
Example Input
10 3
20 25
Example Output
28
Explanation
3update(20) → lastValue = 23update(25) → lastValue = 2828
Constraints
Input
10 3 20 25
Expected Output
28