ICS 111 Homework Assignment H09: Graphical Pair of Dice

Purpose

We are going to continue our problem-solving education and start working with graphics by writing a program that shows a pair of dice. When the user clicks on the panel, the dice are rolled. This will help us understand Java graphics and classes.

We will also get more practice using Eclipse to make our programming life easier.

Tasks

1. Create a package named edu.ics111.h09 in your project

This is where we will put all our classes for homework 09.

2. Create a class GraphicalPairOfDice that extends PairOfDice.

The PairOfDice class is the same class from homework 7.

import edu.ics111.h07.PairOfDice;
. . .
public class GraphicalPairOfDice extends PairOfDice {
  . . .
}

GraphicalPairOfDice should have a method:

/**
 * Draws the given die at x and y.
 * @param g The Graphics context.
 * @param dieNum the number of the die either 1 or 2.
 * @param x the x location for the die.
 * @param y the y location for the die.
 */
public void drawDie(Graphics g, int dieNum, int x, int y) {
  // your code here.
}

3. Modify the Exercise 6.3 to use your GraphicalPairOfDice.

In Exercise 6.3 the void drawDie(Graphics g, int val, int x, int y) method you pass in the value for the die. In our GraphicalPairOfDice the drawDie method takes the die number, either 1 or 2. Use the value of die1 or die2 to draw the die.

4. Be sure the give credit to the textbook, internet, Professor Moore, your TA, or who ever you got help from.

Grading Rubric

CriterionExcellent (100%)Satisfactory (75%)Borderline (50%)Unsatisfactory (25%)Poor (0)
Adherence to standards - 2 points
Does it conform to standards in every detail?
No errors. Minor details of the assignment are violated, or poor choices are made where the assignment is unclear. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills essential functions. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills some essential functions. Misses the point of the assignment.
Breakdown (modular design) - 2 points
Does it demonstrate good modular design?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.
Correctness of code - 4 points
Does it work? Does it pass JUnit?
Passes all tests. Works for typical input, may fail for minor special cases. Fails for typical input, for a minor reason. Fails for typical input, for a major reason. No.
Documentation, and style - 2 points
Is it clear and maintainable? Does it pass CheckStyle?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.

Turning in the Assignment

The assignment is due on Friday, November 5th at 11:55pm. You may turn it in early.