Problem

a. In Chapter 4, you created a Die class that you can use to instantiate objects that ho...

a. In Chapter 4, you created a Die class that you can use to instantiate objects that hold one of six values. Create a GraphicDie class that descends from Die but adds a drawDie() method that draws a representation of the die on the screen. Design the method so it accepts a Graphics object as well as x- and ycoordinate positions where the drawing should be placed. Create the drawing of a Die based on its value and using the drawRect() and fillOval() methods. Save the file as GraphicDie.java.

b. Create a JGraphicDie JApplet that instantiates a GraphicDie object. In the JApplet’s paint() method, pass the method’s Graphics object and two values to the GraphicDie object’s drawDie() method. Save the file as JGraphicDie.java.

c. In Chapter 8, you created a FiveDice3 game in which a player’s random roll of five dice is compared to the computer’s roll and a winner is determined. Now create an applet that plays the game. At each roll, initiated by a player’s button click, display the player’s five dice and the computer’s five dice. Save the file as JFiveDice.java. Figure 17-26 shows a typical game.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT