Chapter 12 
Review Exercise Solutions
R12.1
The software life cycle comprises all activities between the initial conception of a software product and its final retirement.
R12.2
This book recommends the following object-oriented development process:
1.	Discover classes
2.	Determine the responsibilities of each class
3.	Determine the relationships between the classes
R12.3
Classes correspond to nouns in the task description.
R12.4
Methods correspond to verbs in the task description.
R12.5
In an object-oriented programming language such as Java, a method must belong to a class, namely the class that is responsible for the method.
R12.6
•	University–Student: aggregation; a university has students
•	Student–TeachingAssistant: inheritance; a teaching assistant is a student
•	Student–Freshman: inheritance: a freshman is a student
•	Student–Professor: no relationship
•	Car–Door: aggregation; a car has doors
•	Truck–Vehicle: inheritance; a truck is a vehicle
•	Traffic–TrafficSign: no relationship
•	TrafficSign–Color; no relationship. (Color is an attribute)
R12.7
The class BMW can inherit from the class Vehicle–every BMW is a vehicle. However, the BMW company (which is different from the class of all BMWs) is an object of the class VehicleManufacturer. Inheritance is not appropriate for describing the relationship between an object and a class.
R12.8
The Circle.setLocation method needs to move the center of the circle; the radius is not affected. That is exactly what Point.setLocation does, so the method can be inherited.
However, a circle isn’t-a point, so it doesn’t make conceptual sense to use inheritance.
The other way around, it makes some conceptual sense. A point is a circle with radius 0. But then it becomes difficult to construct a circle from a point and a radius, since a point is then only defined in terms of a circle. It makes more sense to define a class Point and then a separate class Circle.
R12.9
Coin	
get value	 	
get name	 	

 	 	

 	 	
 	 	
CashRegister	
record purchase	Coin	
enter payment	 	
give change	 	

 	 	

 	 	
R12.10
BankAccount	
deposit	 	
withdraw	 	
get balance	 	

 	 	

 	 	
Bank	
add account	BankAccount	
get total balance	 	
count	 	
find	 	
get maximum	 	

 	 	
 	 	
R12.11

R12.12
Country	
get area	 	
get density	 	
get name	 	
 get population	 	

 	 	

CountryReader	
read file	 	
get largest area	Country	
get largest density	 	
get largest population	 	

 	 	

Country.html
CountryReader.html
R12.13

Student.html	
Course.html	
ReportCard.html	
Grade.html	
R12.14