COMP 304B Object-Oriented Software Design - Assignment 5 Due date: Monday March 19th, 2007 before 23:55
Practical information
Due date: March 19th
Team size == 1
Your submission must be in the form of a simple HTML file (index.html) with explicit references to all submitted
files as well as inline inclusion of images. See the general assignments page for an index.html template.
If working on this assignment as a team, each team submits only one full solution. The other team member must
submit a single index.html file containing only the coordinates of both team members. This will allow us to put
in grades for both team members in WebCT.
The submission medium is WebCT.
To get insight into the assignment workload, provide the number of hours you spent on this assignment.
The assignment
In this assignment, you will implement the Command Pattern for the physical simulation system you worked on in
assignment 1.
Most of the simulator code is provided (simulator.zip). This includes a command line tool that can parse commands
you type in. Consider this tool as the invoker for your system. The syntax for the commands is as follows:
create [name] [weight] : Add a mass to the simulation.
delete [name] : Delete a mass from the simulation.
push [name] [direction] : Apply a force to a mass in a specific direction for 5 steps. Valid directions are
north, south, est or west.
step [number] : Advance the simulation a number of steps.
undo [number] : Undo the last N actions.
status : Prints the status of the simulation.
help : Print this message.
quit : Quit the application.
Your task is to implement the Command pattern so that the command line tool (invoker) will be able to execute actions on the simulator (receiver). You will need to implement the following commands:
CreateMass
DeleteMass
PushMass
StepSimulation
In addition, your implementation should allow you to undo any number of actions executed on the simulation.
Unfortunately, the ability to undo steps in the simulator has not been implemented. You'll have to implement
that too. Most likely, undo will be a command itself. However, you shouldn't be able to undo an undo command.