Exercise: Exercises Write a class named Octagon that extends GeometricObject and implements the Comparable and Cloneable interfaces. Assume all eight sides of the octagon are of equal length. The area can be computed using the following formula: The Octagon class has a private double data field named side with its getter and setter methods. The class has a no-arg constructor that creates an Octagon with side 0, and a constructor to create an Octagon with a specified side. Write a test program that creates an Octagon object with side value 5 and displays its area and perimeter. Create a new object using the clone method, and compare the two objects using the compareTo method. As far as classes go, the abstract GeometricObject class contains the abstract doubles getArea() and getPerimeter(). The programming language used in this exercise is Java, and it covers the Interfaces topic. I did get how most of the program should look like, but I'm facing trouble understanding a few concepts, so I will appreciate an explanation.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Exercise:

Exercises

Write a class named Octagon that extends GeometricObject and implements the Comparable and Cloneable interfaces.

Assume all eight sides of the octagon are of equal length. The area can be

computed using the following formula:

The Octagon class has a private double data field named side with its getter and setter methods. The class has a no-arg constructor that creates an Octagon with side 0, and a constructor to create an Octagon with a specified side.

Write a test program that creates an Octagon object with side value 5 and displays its area and perimeter. Create a new object using the clone method, and compare the two objects using the compareTo method.

 

 

As far as classes go, the abstract GeometricObject class contains the abstract doubles getArea() and getPerimeter(). The programming language used in this exercise is Java, and it covers the Interfaces topic. I did get how most of the program should look like, but I'm facing trouble understanding a few concepts, so I will appreciate an explanation.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,