Wednesday, May 6, 2020
Programming Language and Real Declare Free Essays
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. We will write a custom essay sample on Programming Language and Real Declare or any similar topic only for you Order Now 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 DriveCar = Start Car Put Car in Reverse Release BrakePedal Turn SteeringWheel Press BrakePedal Put Car in Drive Release BrakePedal Accelerate Car Straighten SteeringWheel End Subprogram Function EnterCar() as Real Set EnterCar = CarEntry End Function Function DriveCar() as Real Set DriveCar = CarDriver End Function End Class Describe the architectural differences between the object-oriented and structured designs. Which of the designs makes more sense to you? Why? A programmer using the top-down, modular approach to program design begins by determining fundamental tasks. An object-oriented programmer, on the other hand, determines the fundamental objects associated with a problem. Structured designs make more sense to me because thatââ¬â¢s what we have been working with over the past 7 weeks. However, I do see the major advantages of object-oriented programming and wish that we had been able to study it more. Right now I am still a rookie at computer programming and do not mind determining the fundamental tasks of programs, it helps me better understand things; but programmers at advanced levels wouldnââ¬â¢t want to have to break down every fundamental task of each program they write. Over time, and with more teaching, I will become more accustom to object-oriented programming. Once this occurs, Iââ¬â¢m sure that I will change the answer to this response. Iââ¬â¢m sure over time and experience, object-oriented programming will make more sense to me. How to cite Programming Language and Real Declare, Essay examples
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.