Lab 7
Start Now

Overview

For this assignment, you will implement the class described by the UML diagram below, or create a class of your own. Also, you are responsible for designing and developing a game that makes use of the class.

Assignment

Prior to the end of lab you must have the Die class or an alternative class of your design implemented. The Die class represents a die with a specified number of sides (selected by passing an integer to the constructor). The die must have at least one side and no more than 100. If no value is passed or if a value outside of this range is attempted, the die should default to having six sides. The roll method must return an integer between one and the number of sides the die has, chosen at random. For example, for a six sided die, the method must return one of the following values with equal likelihood: 1, 2, 3, 4, 5, or 6.

The UML class diagram for the Die class is shown below.

Die
- numberOfSides
+ Die()
+ Die(numberOfSides: int)
+ roll(): int

You must create a game that makes use of the Die class or some alternative class of your own design. The following requirements apply to the game:

  • You must have a separate class with a main method for the game logic.
  • Your game must create at least two instances of the Die (or alternative) class.
  • Your game must require interaction with at least one user.
  • Your game must make use of all of the methods implemented in the Die (or alternative) class.
  • Your game must make use of appropriate methods so that no single method is too complicated.
  • You must document how to play your game.

Sample Submissions

Here are a few submissions from students in the past that may help give you ideas. In order to run these, open a command window and type java -jar lab7a.jar to run the program. Here they are: lab7a.jar, lab7b.jar, lab7c.jar, and lab7d.jar.

Lab Deliverables

See your professor's instructions for details on submission guidelines and due dates.
Dr. Dennis' class: See Blackboard
See Dr. Rebenistch for instructions
Dr. Taylor's class: See below
See Prof. Ung for instructions
Dr. Yoder's submission instructions
If you have any questions, consult your instructor.

Acknowledgement

This laboratory assignment was developed by the Fall 2014 SE1011 instructors.

Tuesday, 16-Feb-2016 10:54:09 EST