Question
Using simple Java: 1. Write a class MyMethods containing the following 2 methods: a method named volume() that accepts 3 integer parameters named width, length,
Using simple Java:
1. 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 returns the average face value of the two die objects. For example, if the first parameter is a Die object with face value 3 and second parameter a Die object with face value 4, the method should return 3.5.
2. 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.
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