Computer Science, asked by saudkarim25, 1 month ago

WAP to calculate the area of triangle and volume of cylinder in java by public static void main function and both should be printed together

Answers

Answered by mrAdorableboy
6

Explanation:

class vol

{

void volume(int s)

{

int vc=s*s*s;

System.out.println(“The Volume of a Cube is”+vc);

}

void volume(double r)

{

double vs=(4/3.0)*3.15*r*r*r;

System.out.println(“The Volume of Sphere is”+vs);

}

void volume(int l, int b, int h)

{

int vcd=l*b*h;

System.out.println(“The Volume of a Cuboid is”+vcd);

}

}

Similar questions