Before we start working on the magic 8 ball project, let’s take a minute to practice creating an object and some properties. In the first challenge of this lesson, we are going to create an object in pseudocode for a chair.
Making a chair may sound a bit strange, but it is a great way to practice creating objects since they have many properties and the properties values will differ for every chair. Don’t forget the abstraction principle. We want to focus on the important properties that are essential to creating a chair.
Now let’s create a chair! First, let’s use the object keyword to let the computer know we are creating an object. We are going to name our object chair.
Next, we are going to create the chair properties. There are three properties in this challenge. So three lines of pseudocode will be for every property. In this example, the three properties you will need are the back, seat, and legs.
For every property, you will use the property keyword before each of the property names. Don’t forget to indent each of the properties underneath the object line we wrote earlier.
Below is an example of how the pseudocode for this challenge might look like. You can add more properties to the chair if you like. The goal here is to practice using the keywords just right.
OBJECT chair PROPERTY back PROPERTY seat PROPERTY legs