©2006 Felleisen, Proulx, et. al.
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. Solution
Write down the data definitions for the information from the GPS problem and translate your examples of this data into the Beginner HtDP language. Solution
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.
Design the data definition in the Beginner HtDP language that represents the information for the bookstore manager and provide data examples of the following three books:
Daniel Defoe, Robinson Crusoe, $15.50, 1719;
Joseph Conrad, Heart of Darkness, $12.80, 1902;
Pat Conroy, Beach Music, $9.50, 1996
Develop an appropriate class diagram and implement it as a Java class. Create instances of the class to represent the same three books. Solution
+----------------------------+ | ClockTime | +----------------------------+ | int hour /* 24 hr clock */ | | int minute | +----------------------------+
Figure: A class diagram for recording the time of day
1.4 Problem
Translate the class diagram in figure 1.3 into a class definition. Also create instances of the class. Solution
Last modified: Wednesday, December 28th, 2005 10:45:23amHTML conversion by TeX2page 20050501