Question: JAVA Define an abstract class called Shape which has the X and Y coordinates of the centar of the shape as attributes. This class should
JAVA
Define an abstract class called Shape which has the X and Y coordinates of the centar of the shape as attributes. This class should be defined to enable the initialisation of both attributes and should encapsulate the attributes with access methods.
Write a class called Circle that inherits from the class Shape. A circle should be initialised with all the attributes of the Shape class and have an attribute for the radius. It should be possible to create a circle without specifying the radius, in which case the radius will default to 1.0.
Write a program that creates 3 Circles and displays the attributes of each.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
