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 2 methods:
a method named volume() that accepts 3 integer parameters named width, length, and height. The method returns the volume of the rectangular box it represents.
For example, if parameter values are 2,3,4, the method returns 24
a method named avgFaceValues() that takes 2 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 tests(invokes) the methods in problem 1. 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 Die(int value){
facevalue - value;
}
??? method roll
public void roll()
Tacevalue int
 WRITING METHODS: Please explain the Java code you give. Write a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!