Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We want to write a Java program to implement classes and methods for geometrical shapes using inheritance and polymorphism Following is the skeleton and description
We want to write a Java program to implement classes and methods for geometrical shapes using inheritance and polymorphism Following is the skeleton and description of the classes that you need to complete: class Point public Point(double x, double y); Creates an instance of point using its x and y coordinates. public double getX ); Returns the x coordinate of the point. public double gety ); Returns the y coordinate of the point. public double getDistance (Point point); Returns the Euclidean distance of the point from a given point. (Remember getDistance) method in Assignment 3?) abstract class Shape [ public abstract double getArea ); It calculates and returns the area of a shape. Note that themethod is abstract and all concrete subclasses of shape should implement it. public abstract double getPerimeter ); It calculates and returns the perimeter of a shape. Again, this method is abstract and all concrete ubclasses of shape should implement it
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