代做CST 8284 Object Oriented Programming I Assignment #3代做留学生Java程序
- 首页 >> Java编程CST 8284 Object Oriented Programming I
Assignment #3
Purpose Demonstrate use of:
• Swing components to build GUI application.
• “secure” random numbers
• good class construction including packages, Javadoc & comments
Task simulate a multi-sided die and “roll” it to obtain random values
Detailed requirements:
• Create a Swing GUI application that simulates a multi-sided die.
• The end-user can set the number of sides. They enter the value in a JTextField.
o If this value less or equal to zero, create a popup error JOptionPane with an appropriate message.
o Similarly, if the end-user enters anything other than a numeric value, create a popup error JOptionPane with an appropriate message.
• Once the number of sides is determined, the end-user can simulate rolling the die by pressing the button at the bottom of the application screen (See Sample Output below.)
o The end-user can click this button multiple times. On each click a new value for the die is shown in read-only JTextField.
o The value is randomly generated. The smallest value is 1 and the largest is the number of sides previously specified.
o Be sure to use the SecureRandom class when generating the random values.
• Implement the handlers as anonymous inner classes (for full marks).
o Other implementations will be given partial marks.
• Application must compile in order to receive marks
o Submissions which do not compile with receive an automatic zero
• Be sure to include Javadoc comments for all public classes and methods. Also be sure to write appropriate comments
• Hints:
o Refer to the code examples from the Theory Lecture in Week 11
e.g. launch3, tempConverter and those demonstrating buttons and handlers
o The font used for the labels and text-fields is: 24 pt “plain” Tahoma
Sample Output:
• For full marks, your implementation must use the same components and same alignments as shown below.
Coding requirements:
• follow the Java Coding Conventions as your "style guide"
• name of the class with the main() method must end in "Test"
• create an Eclipse project
o be sure to name your project Lastname.Firstname.Assign3
o example: Flintstone.Fred.Assign3
• similarly, export your Eclipse project as a .zip following these naming conventions:
o name your file Lastname.Firstname.Assign3.zip
o example: Flintstone.Fred.Assign3.zip Note:
• You will lose marks if you do not:
o follow the instructions under Detailed Requirements
including any algorithms described
o meet the Coding requirements
o produce the same output as the Sample output