Object-oriented analysis

Imagine you are going to write a program to simulate a game of billiards, where colored balls move around a rectangular table, collide with each other, and sometimes fall into pockets at the sides and corners of the table. The “cue ball” is struck under user control to start the action.

Design a set of classes to:

1.      display the table and the position of the balls at any time

2.      simulate the movement of the balls as they strike each other and the walls, and fall into the pockets.

Note that you are not writing the code that carries out the actual simulation. You are only designing the classes that will represent the various objects in the game and their protocol, i.e. the names (and parameters and return types if necessary) of the methods that specify the behavior. The classes should include the type of instance members whenever possible, in the manner of C++ or Java.

You can use any descriptive technique you like (including diagrams) to write your classes. You must however indicate clearly when you are using:

·        inheritance

·        object containment (“composition”)

·        method polymorphism

Points will be awarded for good use of these object-oriented features. Answers without any object-oriented features will be given a failing grade.

Due Date

November 20th. in class.