package lectures.undo_commands;
import util.annotations.WebDocuments;
import lectures.interfaces.BMISpreadsheet;
@WebDocuments({"Lectures/UndoCommands.pptx", "Lectures/UndoCommands.pdf", "Videos/UndoCommands.avi"})
public class ASetWeightCommand implements UndoableCommand {
BMISpreadsheet bmiSpreadsheet;
double oldWeight;
double weight;
public ASetWeightCommand (BMISpreadsheet theBMISpreadsheet, double theWeight) {
bmiSpreadsheet = theBMISpreadsheet;
weight = theWeight;
oldWeight = bmiSpreadsheet.getWeight();
}
public void execute() {bmiSpreadsheet.setWeight(weight);}
public void undo() {bmiSpreadsheet.setWeight(oldWeight);}
}