The way the assignment is leaning, it appears you're supposed to subclass Instruction
- forex:
public class AddInstruction implements Instruction{
public AddInstruction(String l, int r, int s1, int s2) {
// Store the stuff passed in
}
public void execute(Machine m) {
Registers reg = m.getRegisters();
reg.setRegister(r, reg.getRegister(s1) + reg.getRegister(s2));
}
}
Anon.
2010-01-26 00:20:43