Question: Write a program that does the following: 1. Write an abstract class named GeometricShape that has the following members: a color: String, private with
Write a program that does the following: 1. Write an abstract class named GeometricShape that has the following members: a color: String, private with getter and setter methods b filled: boolean, private with getter and setter methods c dateCreated(): java.util.Date, private, with getter method only d public abstract method getArea(): returns a double e public abstract method getPerimeter (): returns a double 2. Write an class named Octagon that extends GeometricShape and implements the Comparable and Clonable interfaces. In addition: a The class has a private double data field named side, with its corresponding getter and setter methods. b The class has a no-arg constructor that creates and Octagon object with side = 0 c The class has a constructor that takes a double as the side length d Assume that all sides of the octagon are of equal length e The area of the octagon can be computed using the following formula: area = (2 + 4/ 2)* side * side 3. Write a test program that: a Creates and Octagon object with side value 5 and displays its area and perimeter Create a new object using the clone () method b Compare the two objects using the compare To() method by comparing objects' side lengths c Sample Program Output: Octagon area is: 120.71, perimeter is: 40.00 Objects are equal Please note: 1. You may only use material covered in this course so far 2. Programs with syntax errors will not be accepted Grading Criteria: 1. Program / Module Description: 10% 2. Following Course Coding Conventions: 10% 3. Correct implementation of GeometricShape class: 30% 4. Correct implementation of Octagon class: 30% 5. Accuracy of results: 20%
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
Here is a Java program that follows the requirements you provided java import javautilDate Abstract class GeometricShape ... View full answer
Get step-by-step solutions from verified subject matter experts
