Examples
- Point.java
- Pixel.java - subclass of
Point; picture: A Pixel Class
- Bicycle.java
- TouringBicycle.java -
subclass of Bicycle; picture: A
TouringBicycle Class
- Circle.java - composition
with Point; picture: A Circle Has A
Point
- Is a Manager an Employee or a
Role? Role.java - superclass
of Manager, Engineer, FileClerk, etc.
|
Lab09
In this exercise you get to design and implement a class hierarchy of
your choice.
- Design and implement a class of your choosing. Give it an
appropriate name (should be a noun).
- Include constructors, getter (aka accessor) and setter (aka
mutator) methods, a toString() method, and other methods both public
and helper, as appropriate.
- Include a main() method that exercises the class.
- Include prompts so that someone running your program knows how to
use it.
- Now design and implement a subclass of your class. Repeat all of
the above for this subclass.
- Your score for this assignment will be based on how well you design
and implement your classes. I.e., your work should exhibit thought,
effort, good design, good programming style, etc.
Be sure to make use of the message passing nature of OOP. Create
objects that model real-world objects. Manipulate those objects in a way
that simulates the way you would manipulate their real-world counterparts. |