18.Write a program to overload a function area() as follows: i) double area( double a, double b) :Calculates and returns area of an ellipse Area = πab ii) double area (double r) : Calculates and returns area of a circle. Area = π × r x r iii) double area (double a, double b, double h): Calculates and returns area of a trapezium. Area = ½(a+b) × h The main() method need not to be written.
Answers
Answered by
1
answer:
class func
{
public double area(double a,double b)
{
ar=22/7*a*b;
return area;
}
public double area(double r)
{
a=22/7*r*r;
return a;
}
public double area( double a,double b,double h)
{
are=1/2*(a+b)*h;
return are;
}
after this u can write the main method and call the functions in it
Similar questions
Economy,
4 months ago
Math,
8 months ago
Math,
8 months ago
Accountancy,
1 year ago
English,
1 year ago