This project is intended to get you to practice some of the programming and design techniques discussed in class recently and consists of four activities:
The complete code to simulate a game of
roulette is given below although you will focus your efforts on
Game and Bet classes.
| Java | C++ |
|---|---|
|
There are many different ways to bet on the results of spinning a roulette wheel. The current program only supports three such ways; however, the next version of the program should support at three additional ways to bet on the results. Analyze the design of the current program from the perspective of how open it is to adding addition kinds of bets and how closed it is to modifcation.
To help direct your analysis, consider the following questions:
You should examine the code given and refactor it to use an inheritance hierarchy of bets such that your refactored code minimizes the amount of new code required to add another type of bet. You may create any new classes you want to solve this problem.
To help direct your refactoring, consider the following questions:
You should provide a set of tests that verify your modified program still works as intended. Tests can be in the form of input data files, driver programs, or other classes that verify every line of code written works as intended.
To help direct your testing, consider the following questions:
Finally, using your improved code, you should add the three bets given in the original specification not implemented code given to you, adding as little new code as possible.
Compare the effort to create a new bet in your improved code to how you would have done it in the original code.