©2005 Felleisen, Proulx, et. al.
Methods and Containment Arrows
Recall the problem of writing a program that assists a book store manager
(cf. homework 1, problem 2). Add the following methods to the
Book class:
currentBook,
which accepts a year and returns true only when the book
was published in the given year;
thisAuthor,
which accepts an author and returns true only when the book
was writted by the given author;
sameAuthor,
which accepts another book and returns true only when the
two books have identical authors.
Homework 1, problem 4 provides the data definition for a weather
recording program. Design the following methods for the
WeatherRecord class
(you may assume that the high is greater than
the low for all instances of TemperatureRange):
withinRange, which determines whether today's high
and low were within the normal range.
rainyDay, which determines whether the precipitation is
higher than some given value.
recordDay, which determines whether the temperature broke
either the high or the low record .
same, which determines whether two different records
represent the same information.