CS 12: Programming Assignment 6

Directory to turnin: as6

Due date: Tuesday Nov 21, 2000

Reading:

Dietel & Dietel, Chapter 9: Inheritance

Synopsis:

In this assignment, you will be using classes and inheritance. You must use the sports team class you developed in Assignment 5.

Files:

Following is the list of files you will create in this assignment:

Team Class:

The Team class you wrote in the last assignment needs to be slightly modified. The private section needs to be changed to protected.

Football Class:

Write a football team class which publicly inherits the sports team class. This class should also contain the following new data members:

The class should also contain the following member functions:

Baseball Class:

Write a baseball team class which publicly inherits the sports team class. This class should also contain the following new data members:

The class should also contain the following member functions:

main.cpp:

This file should contain your main function. It should prompt the user for the name of a football team, the name of a baseball team, and a season (i.e. year), then create a football team and a baseball team object.

The function should then present a menu of options to the user:

      P) play a game
      D) display team info
      S) show stats
      Q) quit

      Select option:
Whenever the user enters an option, you will need to ask whether the football or baseball team should be used. Which team is being used will also affect the play a game option. If a football game is being played, you will need to prompt the user for whether the game was won or lost, the number of touchdowns, and the number of interceptions. If a baseball game is being played, you will need to prompt the user for whether the game was won or lost, the number of home runs, the number of RBIs, and the number of errors.

Put the menu in a loop so that after performing each operation, the menu is shown again, until the user chooses to quit.