AllBestEssays.com - All Best Essays, Term Papers and Book Report
Search

Object-Oriented Data and Processes

Essay by   •  April 23, 2012  •  Essay  •  683 Words (3 Pages)  •  2,364 Views

Essay Preview: Object-Oriented Data and Processes

Report this essay
Page 1 of 3

Object-Oriented Data and Processes

Identify a task performed regularly.

Driving a car!

Write a short, structured design (pseudocode only) that accomplishes this task.

Declare Car Door as Real

Declare Car as Real

Declare Brake Pedal as Real

Declare Drive as Real

Open Car Door

Sit in Car

Close CarDoor

Press BrakePedal

Start Car

Put car in Drive

Release BrakePedal

Accelerate Car

End Program

Think about this task in an object-oriented way, and identify the objects involved in the task.

Involved in this program are the car and the person driving the car. The properties include a car, a door, the handle of the door, and brake pedal. All objects included in this are the car's four tires, the metal surrounding the car, the rubber on the tires, the engine.

Identify how you can encapsulate the data and processes you identified into an object-oriented design.

Class Car Operation

Declare Car as Real

Declare Car Entry as Real

Declare Car Driver as Real

Subprogram Enter Car

Set Enter Car = Open Car Door

Get into Car

Close Car Door

End Subprogram

Subprogram Drive Car

Set Drive Car = Start Car

Put Car in Drive

Release Brake Pedal

Accelerate Car

End Subprogram

Function Enter Car () as Real

Set Enter Car = Car Entry

...

...

Download as:   txt (2.3 Kb)   pdf (50.2 Kb)   docx (9.5 Kb)  
Continue for 2 more pages »
Only available on AllBestEssays.com