Question: According the given Shapes class and Drawer interface, write the Java statements given in the comment line. public abstract class Shapes extends Graphics { public

 According the given Shapes class and Drawer interface, write the Java

According the given Shapes class and Drawer interface, write the Java statements given in the comment line. public abstract class Shapes extends Graphics { public interface Drawer{ abstract double getArea(); void draw(); } } In addition to this, Graphics class has the following methods: drawRect(int x, int y, int width, int height): Draws the outline of the specified rectangle. drawOval(int x, int y, int width, int height): Draws the outline of an oval. a. /*Declare a class with name Rectangle which is subclass of Shapes and able to use method of Drawer interface*/ b. /* define two instance variables x height and width(integer)*/ c. /*define a constructor for Rectangle class such that it initializes the instance variable in part (b)*/ d. /*override the draw() method in drawer interface such that it calls the drawRect( method inside of it.*/ e. /*override the getArea) method in Shapes class such that it finds the area of Rectangle object.*/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!