Starting from:
$35

$29

Programming Assignment 7 Solution




Design and write a Java Swing GUI application that simulates rolling a pair of dice. When a user clicks a button, the application should generate two random numbers, each in the appropriate range (e.g., 1 – 6), to represent the pips on the dice.




Requirements




If your code does not compile, you will receive a score of 0. It is YOUR responsibility to come see ME for help if you need it.
(1 point) The source code file must be named DiceRoller.java.



(1 point) Include a proper Javadoc comment at the top of your program that includes a description of the program and also includes your name.
(1 point) Use comments in the program to document the code. Comments should add to the code, not make the code hard to read.
Your application must have:



(1 point) A frame.



(2 points) At least one label.



(2 points) A button for the user to click to roll the dice.



(2 points) Images for the sides of the dice. Use the ImageIcon class. Images for a 6-sided die are provided on Blackboard. You can use your own, if they are of good quality and size.



(2 points) At least one panel.



(1 point) At least one layout manager that is different from the default layout manager of either the JFrame or JPanel class.
(1 point) At least one border from the BorderFactory class.



(1 point) A mnemonic on the button.



(1 point) At least one tooltip.



(1 point) An embedded main method.



(1 point) A random number generator object from the Random class.



(10 points) For good design. (The window has a good appearance, components are organized well in the window, the window can be resized, etc.)
(10 points) For good implementation. (The application works well, the code for the application is well implemented, frame options are set, etc.)
(2 points) Use good programming practices throughout the code (variable names are descriptive and follow variable naming conventions, properly indent different parts of the code, vertically line up curly braces or headers, lines of code are not longer than 80 characters, etc.).






Submit the source file in Blackboard




Log into Blackboard and go to our course page. Under Content in the left menu, open the folder for the Programming Assignments. Click on the link for Program 7. Under Assignment Submission, use Browse My Computer next to Attach File and find the .java file. Only submit the .java file! When the file has been attached, click the Submit button.

More products