Exercises 3
d) is a logical unit of the computer that performs calculations.
e) is a logical unit of the computer that makes logical decisions.
f) is a logical unit of the computer that coordinates the activities of all
the other logical units.
1.5 (Clock as an Object) Clocks are among the world’s most common objects. Discuss
how each of the following terms and concepts applies to the notion of a clock: class, object,
instantiation, instance variable, reuse, method, inheritance (consider, for example, an
alarm clock), superclass, subclass.
Answer: Class—A class Clock would define the instance variables and methods
that represent a clock’s data and functionality. A clock’s instance variables (at-
tributes) might store the clock’s time, style (digital or analog), etc. The behav-
1.6 (Gender Neutrality) Write down the steps of a manual procedure for processing a
paragraph of text and replacing gender-specific words with gender-neutral ones. Assuming
that you’ve been given a list of gender-specific words and their gender-neutral replace-
ments (for example, replace “wife” or “husband” with “spouse,” replace “man” or “wom-
an” with “person,” replace “daughter” or “son” with “child,” and so on), explain the
procedure you’d use to read through a paragraph of text and manually perform these re-
placements. How might your procedure generate a strange term like “woperchild” and
how might you modify your procedure to avoid this possibility? In Chapter 3, you’ll learn
that a more formal computing term for “procedure” is “algorithm,” and that an algorithm
specifies the steps to be performed and the order in which to perform them.
Answer: Search through the entire paragraph for a word such as “wife” and replace