#include <iostream>
using namespace std;

class Sensor {
private:
   // your code here: declare private int value
   int sensorValue;
public:
   // your code here: implement setValue and getValue
   void setValue(int value) {
      sensorValue = value;
   }
   // Implement getter method (good practice for encapsulation)
   int getValue() const {
      return sensorValue;                            
   }
};

int main() {
   Sensor s;
   s.setValue(75);
   cout << "Sensor value: " << s.getValue();
   return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Sensor value: 75