Write a class named Octagon that extends GeometricObject and implements the Comp
ID: 3758709 • Letter: W
Question
Write a class named Octagon that extends GeometricObject and implements the Comparable and the Cloneable interfaces. Assume that all eight sides of the Octagon are of equal length. The area can be computed using the following formula:
Area = (2+(4/sqrt(2))*side*side)
a. Write a test program that creates a list of four octagon objects with values 5, 10, 8, 4.
b. Your test program should display the area and the perimeter of each octagon object stored in the list
c. Implement the method SumAreas ( ) that sum the areas of all the octagon object in the list. The method signature is: public static double SumAreas (GeometricObject [ ] a)
d. Your program should sort the octagon list based on their areas.
e. Create a new octagon list using the clone method.
Explanation / Answer
Answer :
Driver Class :
import java.util.*;
Octagon Class :
GeometricObject Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.