Question: Java exercise: Return volume as a value (not String) from a method which has 3 parameters 1) Write a program which passes 3 integer arguments

Java exercise:

Return volume as a value (not String) from a method which has 3 parameters

1) Write a program which passes 3 integer arguments (height, width, length) into a method vol(...) .

2) The above method then computes the volume, and returns the volume to the main( ).

3) Show all related values on the screen.

For example, if the sides are 3 by 3 by 6, then your output should be something like: "the volume of a 3x3x6 is 54 cubic feet." Remember: the volume must be returned from a method with 3 parameters.

So, to call the method from the main, one would write something resembling: v = vol(sideA, sideB, sideC);

where all variables above are of the "integer" data type.

Java exercise: Return volume as a value (not String) from a method

class Add int sum(int numi, int num2) return nun1 + num2; public static void main(String[] args) Add add = new Add(); System.out.println("1 + 2 = " + add sum(1,2))

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!