class ForcePoint { int lowerThreshold, upperThreshold; int value = 0; boolean isOn = false; public ForcePoint(int lowerThreshold, int upperThreshold) { this.lowerThreshold = lowerThreshold; this.upperThreshold = upperThreshold; } void feed(int value) { this.value = value; if(isOn==false && value > upperThreshold) { isOn = true; } if(isOn==true && value < lowerThreshold) { isOn = false; } } int getValue() { return value; } boolean isOn() { return isOn; } }