Question: Given the Die class: public class Die { private int face; public Die(int x) { } face=x; public void setFace(int f) { } face
Given the Die class: public class Die { private int face; public Die(int x) { } face=x; public void setFace(int f) { } face = f; public int getface() { } } return face; 1. Write a class named Matrix that: has a data named array, which is a two dimensional square array of Die objects, i.e., both rows and columns are the same number. a constructor, which takes an integer parameter named size representing the array's dimensions, and initializes all the elements of the array to dice with face=1, except for the main diagonal (the row and column indices are the same) to dice with face=5. an equals method that checks whether the object is equal to another Matrix object. 2. Write a Java application named TestMatrix that instantiates two objects of the Matrix class and checks whether the two objects are equal.
Step by Step Solution
There are 3 Steps involved in it
1 public class Die private int face public Dieint x face x public void setFaceint f face f public int getFace return face public class Matrix private ... View full answer
Get step-by-step solutions from verified subject matter experts
