Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need help with this java class and program/driver code ASSIGNMENT 4 Write a program that simulates the rolling of a pair of dice. First,
i need help with this java class and program/driver code
ASSIGNMENT 4 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 GefValue The SetValue method stores a value in the Value field The Getvalue method returns the value of the dice The Roll method that generates a random number in the range of 1 through 6 for the value of the due Rol OutputDice The OutputDice method output the value of the dice as text (e.g. ONE, TWO, THREE, DrawDiceThe DrawDice method draw the dice/an image of the dice (on more than one line using FOUR, FIVE, and SIX) 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/driver class (file [YourNamel-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 code (meaning follow the Assignment Code Convention, explain what each line of code does) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started