Question
Given the following class definition for class Point define a subclass Triangle. The class Triangle contains: g.an array of three points (from the Point class).
Given the following class definition for class Point define a subclass Triangle. The class Triangle contains:
g.an array of three points (from the Point class).
h.Two constructors, one default and one overloaded with an array of Point type as a parameter. Both constructors create a triangle object only the three points form a valid triangle.
i.A valid method to determine if the three points satisfy the following conditions for a legal triangle:
i.The three points are not collinear.
ii.The sum of the lengths of any two sides is larger than the third side.
j.A distance method to find the distance between any two points.
k.An overridden toString() method.
l.An area method to find the area of a tringle if it is a valid triangle. Use Herons formula for calculating the area of a triangle knowing the length of its three sides:
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