Java Reference
In-Depth Information
b. Define the class ExtPerson using the class Person (as defined in
Example 8-8, Chapter 8), the class Date (as designed in this chapter's
Programming Exercise 2), and the class Address . Add a data member
to this class to classify the person as a family member, friend, or business
associate. Also, add a data member to store the phone number. Add
(or override) methods to print and store the appropriate information.
Use constructors to automatically initialize the data members.
c. Define the class AddressBook using previously defined classes. An object
of type AddressBook should be able to process a maximum of 500 entries.
The program should perform the following operations:
Load the data into the address book from a disk.
i.
Sort the address book by last name.
ii.
Search for a person by last name.
iii.
Print the address, phone number, and date of birth (if available) of a
given person.
iv.
Print the names of the people whose birthdays are in a given month or
between two given dates.
v.
Print the names of all the people between two last names.
vi.
In Programming Exercise 2, the class Date was designed and implemented
to keep track of a date, but it has very limited operations. Redefine the
class Date so that, in addition to the operations already defined, it can
perform the following operations on a date:
a. Set the month.
b. Set the day.
c. Set the year.
d. Return the month.
e. Return the day.
f. Return the year.
g. Test whether the year is a leap year.
h. Return the number of days in the month. For example, if the date is 3-12-2015,
the number of days to be returned is 31, because there are 31 days in March.
i. Return the number of days passed in the year. For example, if the date
is 3-18-2015, the number of days passed in the year is 77. Note that the
number of days returned also includes the current day.
j. Return the number of days remaining in the year. For example, if the
date is 3-18-2015, the number of days remaining in the year is 288.
k. Calculate the new date by adding a fixed number of days to the date. For
example, if the date is 3-18-2015 and the days to be added are 25, the
new date is 4-12-2015.
l. Return a reference to the object containing a copy of the date.
7.
Search WWH ::




Custom Search