Frame a class Sensor with the following:
id
value
Sensor(int id, int value)
void setValue(int v)
bool isAboveThreshold(int t) const
int getId() const
The input will contain:
n
Sensor <id>: ALERT
or
Sensor <id>: NORMAL
depending on whether the reading meets/exceeds the threshold.
Example Input:
3 101 75 60 202 30 50 303 100 100
Output:
Sensor 101: ALERT Sensor 202: NORMAL Sensor 303: ALERT
Here, n = 3. For the first line: id = 101, value = 75, threshold = 60.Explanation:
Input:
2 1 0 1 2 255 128
Sensor 1: NORMAL Sensor 2: ALERT
Explanation:
Test Cases
Test Results
Input
Expected Output