Using Java Answer Following 1 Implement Method Dicestats Takes Integer Parameter Num Metho Q43839264
Using Java answer the following: 1. Implement a methoddiceStats() that takes an integer parameter, num. The methodcreates a square matrix (2-dim array) of die objects and rolls themall. The method returns an int array of size 6, containing thenumber of dice in the matrix for each face value 1-6. For example,if the matrix is of size 2 and dice have the following face values:2 4 4 5 the method will return 0,1,0,2,1,0 You may use the Dieclass introduced in class.
2. Write an application that tests this method.
Die.java
public class Die {
private int faceValue;
public Die() {
faceValue=(int)(Math.random()*6)+1;
roll();
}
public Die(int value) {
faceValue=value;
}
public int getFaceValue() {
return faceValue;
}
public void setFaceValue(int value) {
faceValue=value;
}
public void roll() {
faceValue=(int)(Math.random()*6)+1;
}
public String toString() {
return “Die with face: “+faceValue;
}
}
Expert Answer
Answer to Using Java answer the following: 1. Implement a method diceStats() that takes an integer parameter, num. The method crea…
OR