#include <iostream>
using namespace std;
class Sensor {
private:
int id;
int value;
public:
Sensor(int id_, int value_) : id(id_), value(value_) {}
void setValue(int v) {
value = v;
}
bool isAboveThreshold(int t) const {
return value >= t;
}
int getId() const {
return id;
}
};
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
int id, val, th;
cin >> id >> val >> th;
Sensor s(id, val);
if (s.isAboveThreshold(th))
cout << "Sensor " << s.getId() << ": ALERT\n";
else
cout << "Sensor " << s.getId() << ": NORMAL\n";
}
return 0;
}
Solution Details
Input
3 101 75 60 202 30 50 303 100 100
Expected Output
Sensor 101: ALERT Sensor 202: NORMAL Sensor 303: ALERT