Details of this Paper

Write a program that simulates the rolling of a pair of dice

Description

solution


Question

Write a program that simulates the rolling of a pair of dice.;First, write a class called Dice (file Dice.java) that simulates a single dice (the singular for dice is die but in;modern English dice is an acceptable singular so I will call the class Dice). The Dice class should have the;following fields and methods (with these names and caps);Field/Method Description;Value The Value field holds the value of the dice;SetValue The setValue method stores a value in the Value field;GetValue The getValue method returns the value of the dice;Roll The Roll method that generates a random number in the range of 1 through 6 for the;value of the due;OutputDice The OutputDice method output the value of the dice as text (e.g. ONE, TWO, THREE;FOUR, FIVE, and SIX);DrawDice The DrawDice method draw the dice/an image of the dice (on more than one line using;ASCII characters and/or symbols) in the console window (not a dialog box), This method is;optional (for 5 extra credit points);Once you have designed the class, design a program (file [YourName]-Assignment4, replace [YourName] with;your actual name) that creates two objects/instances of the Dice class to simulate a pair of dice. The program;should simulate the rolling of the 2 dice and display their values (using the OutputDice method, and, if you did;the extra credit, also using the DrawDice method). Document your program (meaning follow the Assignment;Code Convention, explain what each line of code does).;You can earn/loose additional points according to the following table;+5 For drawing the 2 dice using ASCII characters or symbols, impress me and you will get more;-5 For not documenting your code (should have a comment for each line of code, field, method, class, program;etc);-5 Every time you use a concept we did not study in class yet like like repetition, user-defined functions, etc.;-5 For not using the correct program name or file name that does not have your name in it;-5 For not submitting the correct files

 

Paper#69462 | Written in 18-Jul-2015

Price : $27
SiteLock