public class AndGate extends LogicGate{ public AndGate(int inputnr) { super(inputnr); if(inputnr>8){ throw(new TooManyInputsException()); } } public AndGate(DigitalInput... inputvals) { super(inputvals); } @Override public boolean getOutput() { boolean state = getInput(0).getValue(); for(int i = 1; i < getInputNumber(); i++){ state &= getInput(i).getValue(); } return state; } }