Question: We have introduced Abstract Classes and Interfaces in the lectures. In this lab, we would like to provide few questions to review these topics and
We have introduced Abstract Classes and Interfaces in the lectures. In this lab, we would like to provide few questions to review these topics and hands-on to solve them. Write a class named Octagon that extends GeometricObject and implements the Comparable and 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 Squareroot 2) * side * side Write a test program that creates an Octagon object with side value 9 and displays its area and perimeter. Create a new object using the clone () method and compare the two objects using the compareTo() method. Expected results: Area is 391.10 Perimeter is 72.0 Compare the methods 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
