Ellipse program:
Java’s API classes make extensive use of inheritance. For example, Sun’s Java API documentation shows that the java.awt.geom.Ellipse2D package has a class named Double that has these instance variables:
| heightThe overall height of the |
| widthThe overall width of this |
| xThe x coordinate of the upper left corner of this |
| YThe y coordinate of the upper left corner of this |
And it has these constructors:
Double()Constructs a new |
Double |
It has accessors for the instance variables, and an initializing method, but that’s about all. Fortunately, this class extends a class called Ellipse2D, which has several other useful methods, including:
| contains |
| contains |
| intersects |
Write a short program in a class called EllipseDriver:
Import java.awt.geom.Ellipse2D.Double, and write a main method that calls the 4-parameter Double constructor to instantiate an ellipse like that shown in the picture below. Then, in println statements, call the superclass’s 2-parameter contains method to show whether the points x=3.5, y=2.5 and x=4.0, y=3.0 are contained within the specified ellipse.

Output:
contains x=3.5, y=2.5? false contains x=4.0, y=3.0? true
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.