InclassInheritance042009[1]

InclassInheritance042009[1] - 2. Create a class named...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 106:  04/20/09 Inheritance 1.  Create a class named Book that contains data fields for the title and number of pages.  Include get and set methods for these fields.  Next, create a subclass named Textbook  which contains  an additional field that that holds grade level for the Textbook and  additional methods to get and set the grade level field.  Write an application that  demonstrates using objects of each class.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2. Create a class named Square that contains data fields for height, width and surfaceArea, and a method named computeSurfaceArea(). Create a child class named Cube. Cube contains an additional data field named depth and a computeSurfaceArea() method that overrides the parent method. Write an app that instantiates objects of both classes....
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online