0% found this document useful (0 votes)
30 views4 pages

5th Ed Ch01 QC

The document provides solutions to quick check questions about object-oriented programming concepts. It includes examples of class and object diagrams demonstrating classes, objects, instance variables, inheritance hierarchies, and the software development life cycle stages of analysis, design, coding, testing, and operation. Poor design can increase maintenance costs due to higher debugging needs to locate and correct errors.

Uploaded by

sepepebin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

5th Ed Ch01 QC

The document provides solutions to quick check questions about object-oriented programming concepts. It includes examples of class and object diagrams demonstrating classes, objects, instance variables, inheritance hierarchies, and the software development life cycle stages of analysis, design, coding, testing, and operation. Poor design can increase maintenance costs due to higher debugging needs to locate and correct errors.

Uploaded by

sepepebin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Solutions to

Quick Check Questions 1


Introduction to Object-Oriented
Programming and Software
Development

1.1 Classes and Objects

1. Draw an object diagram for a Person class and two Person objects
Ms. Latte and Mr. Espresso.

Person

Ms Latte : Person Mr Espresso : Person

2. What must be defined before you can create an object?

A class which the object belongs must be defined first.

1
2 Solutions to Chapter 1 Quick Check Questions

1.2 Messages and Methods

1. Draw an object diagram of an Account object with instance methods


deposit and withdraw.

Here’s one possible diagram of withdrawing and


depositing 200.

withdraw(200)

deposit(200) acct1 : Account

2. Is the getObstacleDistance method an instance or a class method?

It is an instance method because the value would be different for


each instance.

1.3 Class and Instance Data Values

1. What is the difference between a constant and a variable?

During the program execution, you can change the value of a vari-
able, but you cannot change the value of a constant once its value is
assigned at the declaration.
Solutions to Chapter 1 Quick Check Questions 3

2. Draw an object diagram of a Person object with three instance vari-


ables name, age, and gender.

per1 : Person
name

age

gender

1.4 Inheritance

1. If Class A inherits from Class B, which is a superclass? Which is a


subclass?

B is the superclass, and A is the subclass.

2. Draw an object diagram that shows Class A is inheriting from Class


B.

3. What are the other names for superclass and subclass?

A superclass is also an ancestor of its subclasses. A subclass is also


a descendent of its superclass. They are also called base and de-
rived classes, respectively.
4 Solutions to Chapter 1 Quick Check Questions

4. If we have Animal, Insect, and Mammal classes, which one will be a


superclass?

Since Insect and Mammal are subspecies of Animal, Animal should


be the superclass of Insect and Mammal.

5. Model different types of vehicles, using inheritance. Include Vehicle,


Automobile, Motorcycle, SportsCar, Sedan, and Bicyle?

Here’s one possible hierarchy:


Vehicle

Automobile Bicycle Motorcycle

SportsCar Sedan

1.5 Software Engineering and Software Life Cycle

1. Name the stages of the software life cycle.

The stages are Analysis, Design, Coding, Testing, and Operation.

2. How does the quality of design affect the software maintenance cost?

A poorly designed software is more costly to maintain than a prop-


erly designed software.

3. What is debugging?

An activity to locate and correct errors in software. By designing a


software properly, we can minimize the amount of time we spend on
debugging.

You might also like