Describe the

Week Eight CheckPoint: Object-Oriented Data and Processes

 

  1. Identify a task you perform regularly, such as cooking, mowing the lawn, or driving a car.

 

What task are you going to describe? Let’s make a cup of tea.

 

 

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

 

You need to follow proper design principals

 

Main Module

Call Boil_Water Module

Declare Sugar as an Integer

Sugar = Call How_Many_Sugar Module

Call Prepare_Cup module

End Main Module

 

Boil_Water Module

Declare Temperature as Integer

If Temperature < 212 degrees Fahrenheit

Turn Heat on

Display “Water is not ready”

Else If Temperature = 212 degrees Fahrenheit

Turn Heat off

Display “Water is ready.”

End Boil_Water Module

 

Integer How_Many_Sugar Module

Declare Integer Sugar

Display “Enter How Many Teaspoon(s) of Sugar”

Input Sugar

End How_Many_Sugar Module

 

Prepare_Cup Module

Declare Tea_Flavor as String

Display “What flavor of tea do you want?”

Input Tea_flavor

Display “Adding Boiling Water”

Display “Added” Tea_flavor “to cup.”

Display “Added” Sugar “teaspoons of sugar to cup”

Display “Stirring Tea”

Display “Tea is ready to drink”

End Prepare_Cup Module

 

 

  1. Thinkabout this task in an object-oriented way, and identify the objects involved in the task.
    1. Teapot
    2. Water
    3. Cup
    4. Tea flavor
    5. Sugar

 

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

The teapot is the object and when the water is added and heat is turned on the process of making a cup of tea begins. The water communicates back and forth telling the program the temperature of the water and when it is ready to proceed. Next the user will send messages to the program so it knows the amount of sugar and the flavor of tea.

 

 

  1. Describe the architectural differences between the object-oriented and structured designs. Which of the designs makes more sense to you? Why?

Object oriented programming can store data and send messages to other objects. They can also receive messages from other objects. Object oriented program is much more intuitive for real life situations rather than architectural programing.

Object oriented design makes more sense to me, because it resembles real life and it makes the code reusable which could save time.

Leave a Reply