©2005 Felleisen, Proulx, et. al.
Simple classes
Translate the three examples of information from the GPS problem into
instances of GPSLocation
.
Copy the class definitions from the textbook and show the examples as data in the Examples class.
What is the meaning of new GPSLocation(50.288,0.11)
in this
context? Include your answer as a block comment in the file that
holds the rest of the problem answers.
Take a look at this problem statement:
Develop a program that assists a bookstore manager. The program should keep a record for each book. The record must include its book, the author's name, its price, and its publication year.Develop an appropriate class diagram and implement it with a class. Create instances of the class to represent these three books:
Daniel Defoe, Robinson Crusoe, $15.50, 1719;
Joseph Conrad, Heart of Darkness, $12.80, 1902;
Pat Conroy, Beach Music, $9.50, 1996
+-------------------------+ | Auto | +-------------------------+ | String model | | int price /* dollars */ | | double mileage | | boolean used | +-------------------------+
Figure 1: A class diagram for automobiles
1.3 Problem (2.1.4)
Translate the class diagram in figure 1 into a class definition. Also create instances of the class.
Last modified: Monday, January 10th, 2005
HTML conversion by TeX2page 2004-09-11