Make an interface with a name polygon


Problem

Make an interface with a name "Polygon."

A. In this interface, declare two methods (signatures only) with a name "getArea()" and "getSides()."

B. Create two new classes Rectangle and Square. Use the "getArea()" and "getSides()" methods in both classes to print the area of both shapes and also to print the sides of both the shapes.

C. Create two objects of both Rectangle and Square classes with the names R1 and S1.

D. Invoke these objects by passing the data to the methods "getArea()" and "getSides()" through the appropriate constructor.

E. Here data means passing length and breadth for "getArea()" method and passing number of sides to "getSides()" method.

F. After receiving the data from the objects, the "getArea()" method should calculate and print the area of that shape.

G. Similarly, the "getSides()" method should print the number of sides that a shape possesses.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Make an interface with a name polygon
Reference No:- TGS03319594

Expected delivery within 24 Hours