If your design is going to be implemented by Java programming,
each of the events in your state diagram will eventually be
represented by some method invocation (we saw this in the previous
homework, where mouse events turn into method calls). Choose one
event relevant to the state diagram, and for that event, state
what are the "pre" and "post" conditions for that event.
The precondition is a generic description of variables and objects
before the event, and the
postcondition is a generic description of variables and objects
after the event. So, in other words, your pre- and post-conditions
will indicate specify what kind of change to variables and objects of
Q3 are occur due to that event.
Examples (will be covered in class)
pre: x==k and y==j
what event handler does: { if (x<100) { x=x+1; y=y-1;} }
post: k<100 ==> x==k+1 and y==j-1
k>=100 ==> x==k and y==j
pre: Q == R, where R is a queue of items [x1,x2,...]
what the event handler does:
{ a = Q.deQueue(); }
post: R empty ==> a == NULL and Q is empty
R == [x1,x2,...] ==> a == x1 and Q == [x2,...]