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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started