Randomizer Project: Day 4

Abstract Classes


Videos

The Randomizer Project

This project will serve as a way to introduce students to the advanced Java concepts of Interfaces, Classes, Objects, Object Inheritance, Polymorphism, Extending Classes, and the use of Abstract Classes.

It will do this in the framework of creating a series of classes that can be used in any game context to introduce randomness into the game.

Therefore we will call all such classes Randomizers!

In day 4 of the series of video tutorials we will learn how to improve our reuse of existing code through the concept of abstract classes.

We will begin by writing an abstract version of the Randomizer interface which will then be extended to create all of our other Randomizer classes: Coin, D6, and PolyhedralDie.

Note that we won't have to alter the LabeledPolyhedralDie class because it already extends the PolyhedralDie class!

For this project, you can find the code for the interface, the abstract class, and the first re-write of the Coin class in this PDF IconPDF. However, you should try to write your own versions of the remaining classes, so the code for those classes is not in the PDF. You will find solutions to each of these classes as a separate video however, should you get stuck or want to check your work!

You may download the completed code from day 3 as an Eclipse Project: .zip IconRandomizerProject_Day3_End.zip.

You may download the completed code from day 4 as an Eclipse Project: .zip IconRandomizerProject_Day4_End.zip.