CPE 102

Winter 2016

Lab 2

Objectives

Resources

Ground Rules

Orientation

You will be developing two classes to support the game of Rochambeau and that work with the provided RochambeauGame.java driver.  Note that the provided game driver expects mostly correct input from the user – no guarantees if you respond to its prompts with unexpected values!  The RochambeauPlayer class will make use of the Random class from the Java Standard API to simulate random behavior of picking a Rochambeau "throw".  The Rochambeau class will provide the functionality to determine the winner between two "throws".

Note: The word throw is a keyword in Java.  Be careful when picking variable names.

Part 1

Develop the Rochambeau class to meet the specification.

Part 2

Develop the RochambeauPlayer to meet the specification.  Be sure to perform sufficient unit testing as you go to be sure the constructors and methods of this class perform as specified.  You must use the Random class to choose a "throw" for one of the makeThrow() methods.  Note that this method is overloaded, you only need use the Random class for one of the makeThrow() methods.  (Please see me if you do not know what that term means.)  You Use the nextInt() method of the Random class that accepts an integer parameter.  Be sure to update lastThrow in both of the makeThrow() methods.

Part 3

Download the provided copy of RochambeauGame.java, add it to your project, compile, and test. Be sure you understand everything that is happening in this class, except for the Scanner class. We will cover that next week.

Lab courtesy of Julie Workman.