Preview

Programming Language and Real Declare Essay Example

Satisfactory Essays
Open Document
Open Document
506 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Programming Language and Real Declare Essay Example
Identify a task you perform regularly, such as cooking, mowing the lawn, or driving a car.

I used driving a car as the example in this checkpoint.

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

Declare CarDoor as Real
Declare Car as Real
Declare BrakePedal as Real
Declare Reverse as Real
Declare SteeringWheel as Real
Declare Drive as Real

Open CarDoor Sit in Car Close CarDoor Press BrakePedal Start Car Put Car in Reverse Release BrakePedal Turn SteeringWheel Press BrakePedal Put Car in Drive Release BrakePedal Accelerate Car Straighten SteeringWheel End Program

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

The car is an object involved in the task. Properties include: made of metal, plastic, and rubber, has four tires, has a front and back windshield, has driver and passenger windows, has a steering wheel, a shifter, headlights, taillights, an engine, a transmission and a gas tank. Functions include: transports the user to their desired destination. Works on: the road.

The car door is an object involved in the task. Properties include: made of metal, has a handle and a lock, encases a window. Functions include: secures passenger into vehicle, housing for window, and mirror attaches to it. Works on: a vehicle.

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

Class CarOperation Declare Car as Real Declare CarEntry as Real Declare CarDriver as Real

Subprogram EnterCar Set EnterCar = Open CarDoor Sit in Car Close CarDoor End Subprogram Subprogram DriveCar Set

You May Also Find These Documents Helpful