AP Comp Sci Chap 3--Test for Mr. R's Classy Students,
Part 1
Name ______________________________________ Date
_______________
Write an application with 2 classes and an interface: a library,
and a book class and a binding interface.
The library class: will contain 2 books. The class will age each
books by 20 years and then output the name and age for each book in a well
labeled table.
The binding interface: will specify one method with no return or
parameters called aging.
The book class: will have 2 fields: name of book and age of
book. The book class will also have 2 constructors, one with no parameters
that sets default values for the fields, and a second with parameters for
setting name and age. The default value for name will be "unknown" and
for the age will be 1. The class will implement the binding interface and
set up the interface's method so that it increases a book's age by one
year whenever the method is run..
|