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
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
Accountancy,
1 month ago
Math,
3 months ago
Science,
10 months ago
Physics,
10 months ago
Science,
10 months ago