Question
Using Java 1. Create a class called PairOfDice in Java 2. . Objects of this class represent a single pair of six-sided dice. The only
Using Java
1. Create a class called PairOfDice in Java
2. . Objects of this class represent a single pair of six-sided dice. The only attributes of such an object are the face values of the dice. Provide a constructor.
3.Provide a roll method that simulates rolling the dice
4.. Provide a value method that returns the sum of the face values of the dice. Provide a toString method that returns a nicely formatted string representing the pair of dice, for example 5 : 3 = 8. Finally, create a test driver class containing the main method that demonstrates that your PairOfDice class performs correctly
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