Week 9: Currency Conversion
CheckPoint Week 8: Object-Oriented Data and Processes
1) Selected task is driving a car.
2) Pseudocode: Main Module Call Initiate Car Start Up Function Call Start Drive Function Call Turn Off Car Function End Main Module Initiate Car Start Up Function Display "Car Started successfully" End Initiate Car Start Up Function Initiate Start Drive Function Declare Dir as String Display "Input Command" Input Dir If Dir = "Slow Speed Down" Display "Slowing Speed Down" Else If Dir = "Stop vehicle" Display "Stopping the Car" Else If Dir = "Turn vehicle Left" Display "Turning Car Left" Else If Dir = "Turn vehicle Right" Display "Turning Car Right" Else If Dir = "Speed vehicle Up" Display "Accelerating the Car" Else If Dir = "Shifting Gears" Display "Shifting the Gears" End If End Start Drive Function Initiate Turn Off Car Function Declare Dir as String Display "Input ‘T’ to turn off the Car" Input Dir If Dir = "T" Display "Turning Car off" End Turn Off Car Function
3) Identify the objects involved in the task. Objects include: The accelerator The wheel
The foot for brake/accelerator
The hands for steering the wheel The four tires The gears The ignition The car's engine
The brakes
The speedometer
4) Encapsulating the data and processes you identified into an object-oriented design. The foot sends an outgoing message to the accelerator by press it. The Accelerator then, keeping in view the, parameter of the message it receives from the foot i.e. how hard have you accelerated, pings the engine to start the car or make it move. The hands send a message to the wheel regarding the direction. Based on that message, the steering wheel can send a message to the tires telling them to turn into the specified direction.