CS 1713 Section 1 Spring 2011, Homework 4

Inheritance

Do the following Programming Projects from the book:
  1. PP 8.2: Design and implement a set of classes that define the employees of a hospital: doctor, nurse, administrator, surgeon, receptionist, janitor, and so on. Include methods in each class that are named according to the services provided by that person and that print an appropriate message. Create a main driver class to instantiate and exercise several of the classes. Hint: A surgeon is a doctor, so make surgeon a subclass of doctor.

  2. PP 8.11: Design and implement a set of classes that define a series of three-dimensional geometric shapes. For each store fundamental data about their size and provide methods to access and modify this data. In addition, provide appropriate methods to compute each shape's area and volume. In your design, consider how shapes are related and thus where inheritance can be implemented. Create a main driver class to instantiate several shapes of differing types and exercise the behavior you provided.

    Note: "series of three-dimensional shapes" means at least the following:

    Click on the links above to read the Wikipedia page on each shape so you can find or derive the formulas for the volume and area.

What To Turn In

Turn in each Java file as a separate attachment to a single email message to our teaching assistant. The Java file with the main method for PP 8.2 should be named "PP2.java" and the Java file with the main method for PP 8.11 should be named "PP11.java".

This program is due at 11:59pm, Friday, March 4, 2011. Late assignments will not be accepted. If you're not done with some part before it's due, turn in what you have for partial credit. Don't cheat.