Question: WRITING METHODS: Please explain the Java code you give. Write a class MyMethods containing the following 2 methods: a method named volume ( ) that
WRITING METHODS: Please explain the Java code you give.
Write a class MyMethods containing the following methods:
a method named volume that accepts integer parameters named width, length, and height. The method returns the volume of the rectangular box it represents.
For example, if parameter values are the method returns
a method named avgFaceValues that takes Die objects as parameters Use the Die class developed in class The method rolls the dice repeatedly until they land on same faceValue, and returns the number of times both die objects had odd face values.
Write an application, TestMethods, that testsinvokes the methods in problem The program should instantiate an instance object of the class MyMethods and invoke the methods with made up parameter data. The application should have at least one invocation of each method. Please use the already given die class to write the code. Definition of the Die class
public class Die
data declaration
private int facevalue;
defaut l constructor no parameters
public Dic
roll:
public Dieint value
facevalue value;
method roll
public void roll
Tacevalue int
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
