CS 3100
Fall 2008
Lab 3
Due Monday, November 3, 2008

The purpose of this assignment is to get a better understanding of inheritance in C++ by writing and using derived class.

Base class: we will use the sphere class from the book, here is code for Sphere.h and Sphere.cpp.

You will write a two classes: Ball and Colored Ball, and a driver.

Ball is a derived class of Sphere with added data "name". The displayStatistics() method will also need to be modified to display the name.

ColoredBall is a derived class of Ball with added data "color". The displayStatistics() method will also need to be modified to display the color.

Write a driver that allows the user to create and modify instances of all three classes. As discussed in class, the driver should provide a menu of options for the user and allow the user to continue creating, modifying, viewing class instances until the user desires to stop.

You may add additional data and functionality to your classes as desired.


What To Turn In:

Here is the list of things you have to turn in:
  1. At the start of class on the due date, place the following items on the "counter" in front of me:
    • a hardcopy of your final version of the program source code.


  2. Upload to the homework submission system before midnight on the due date
Your final source code and your test script. I will compile and test your programs on the suns in the lab.