Question

A line on a plane can be represented by coordinates of the two-end points p1 and p2 as p1(x1,y1) and p2(x2,y2).A super class Plane is defined to represent a line and a subclass Circle to find the length of the radius and the area of circle by using the required data members of super class.Some of the members of both the classes are given below:Classname:PlaneData members/instance variables:x1:to store the x-coordinate of the first end pointy1:to store the y-coordinate of the first end pointMember functions/methods:Plane(int nx,int ny):parameterized constructor to assign the data members x1=nx and y1=nyvoid Show():to display the coordinatesClassname:CircleData members/instance variables:x2:to store the x-coordinate of the second end pointy2:to store the y-coordinate of the second end pointradius:double variable to store the radius of the circlearea:double variable to store the area of the circleMember functions / methods:Circle(…):parameterized constructor to assign values to data members of both the classesvoid findRadius():to calculate the length of radius using the formula:(âˆš(x2-x1)2+(y2-y1)2 )/2assuming that x1, x2, y1, y2 are the coordinates of the two ends of the diameter of a circlevoid findArea():to find the area of circle using formula: Ï€r2.The value of Ï€ is 22/7 or 3.14void Show():to display both the coordinates along with the length of the radius and area of the circleSpecify the class Plane giving details of the constructor and void Show(). Using the concept of inheritance, specify the class Circle giving details of the constructor,void findRadius(),void findArea() and void Show().The main function and algorithm need not be written.

Code

```				```
public class Plane
{
double xl,yl;
Plane(double nx,double ny)
{
xl=nx;
yl=ny;
}

void Show()
{
System.out.println("x-coordinate="+xl);
System.out.println("y-coordinate="+yl);
}
}

public class Circle extends Plane
{
Circle(double nx,double ny,double a,double b)
{
super(nx,ny);
x2=a;
y2=b;
}

{
}

void findArea()
{
}

void Show()
{
super.Show();
System.out.println("Second x-coordinate="+x2);
System.out.println("Second y-coordinate="+y2);
System.out.println("Area ="+area);
}
}

```
```

Sale

50
Sale

150
Sale

200
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50