View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007

Fall2001 Midterm Review: Simulate a Motorcycle

Link back to Fall 2001 Midterm Review

1. key: myEngine
engine: myWheel
wheel: no instance variables
2. insert
myEngine start.

start
putt := [
self run.
] newProcess.
putt priority: (Processor userBackgroundPriority).
putt resume.

run
(Delay for seconds: 1) wait.
Transcript show: 'Putt!'.
myWheel turn.

turn
Transcript show: 'Turn!'.

3. engine: e
myEngine := e.

wheel: w
myWheel := w.

4. e := Engine new.
k := Key new.
w := Wheel new.
e wheel: w.
k engine: e.
k insert.
Jesse Shieh

1)key - engine
engine - process, wheel
wheel - heading
2)
key)
insert
engine start.

engine)
start
process := [[true] whileTrue: [ (Delay forSeconds: 1) wait.
self run. ]. ] newProcess.
process resume.

run
Transcript show: 'Putt!';cr.
wheel turn.

wheel)
turn
Transcript show: 'Turn!'.
heading := heading + 1.

3)
key)
engine: anEngine
engine := anEngine

engine)
wheel: aWheel
wheel := aWheel

wheel)
heading: aDirection
heading := aDirection.

4) k := Key new.
e := Engine new.
w: = Wheel new.
k engine: e.
e wheel: w.
w heading: 0.
k insert.
Jared Parsons






Link to this Page