Computer Science, asked by minisuresh579, 3 months ago

Create a class Overloading with the following members

void volume (int)
to find the volume of a cube
volume of a cube =side*side*side
void volume ( double ,double, double) to find the volume of a cuboid
volume of a cuboid = length x breadth x height​

Answers

Answered by razaahmadbeg
2

Answer:

HERE IS YOUR ANSWER

Explanation:

import java.util.Scanner;

class Overloading

{

int n;

double l,b,h;

public void volume(int a)

{

n=a;

System.out.println(" The volume of the cube is : "+Math.pow(n,3));

}

public void volume(double p,double q,double r)

{

l=p;

b=q;

h=r;

System.out.println(" The Volume of the cuboid is : "+(l*b*h));

}

}

Similar questions