#include <iostream> using namespace std; // Define Sensor class here // <write your code> class Sensor{ private: int rawValue; int offset; public: void setRaw(int Value); void calibrate(int off); int read(); }; void Sensor::setRaw(int Value) { rawValue = Value; } void Sensor::calibrate(int off) { offset = off; } int Sensor::read() { return rawValue + offset; } int main() { int raw, offset, newRaw; cin >> raw >> offset >> newRaw; Sensor s; s.setRaw(raw); s.calibrate(offset); s.setRaw(newRaw); cout << s.read(); return 0; }
Test Cases
Test Results
Input
100 -5 120
Expected Output
115