Write a program that does the following: 1. Write an abstract class named GeometricShape that has...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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% 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% 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%
Expert Answer:
Answer rating: 100% (QA)
Here is a Java program that follows the requirements you provided java import javautilDate Abstract class GeometricShape ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
The ledger of Blossom Corporation has the following account balances at the company's first year end of October 31, 2022. Accounts payable $3,090 Interest payable 210 Accounts receivable 4,410...
-
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 size. The area can be computed...
-
The organizing committee for the HCC Celebrates Columbia's 50th Birthday, Inc., has planned a special event commemorating notable people originally from Columbia, MD. The committee has invited the...
-
Solve each system. If a system is inconsistent or has dependent equations, say so. -5x + 2y = -4 6x + 3y = -6
-
Brooks Hardware reported cost of goods sold as follows. Brooks made two errors:1. 2011 ending inventory was overstated by $2,000.2. 2012 ending inventory was understated by $5,000.InstructionsCompute...
-
Acetic acid, the sour constituent of vinegar, has the following structure: Indicate what geometry given below is expected to be found about each of the atoms labeled a, b, and c. - (iv) (iii)
-
There is a lightbulb exactly halfway between the front and rear of a long hallway in your spaceship. Your ship is traveling at \(0.5 \mathrm{c}\) relative to the earth. The bulb is suddenly turned...
-
In performing a test of controls for sales order approvals, the CPAs stipulate a tolerable deviation rate of 8 percent with a risk of assessing control risk too low of 5 percent. They anticipate a...
-
Assigned group leaders of each module are responsible for setting up the Padlet and making sure their group understands what is expected for each project. How will you, when you are assigned the role...
-
Use the superposition principle to find io and vo in the circuit Fig. 4.79? Figure 4.79 For Prob. 4.11. 10 10 20 6 A 40 4 +30 V 10
-
Carbonic acid is a diprotic acid while formic acid is not. Why? (It may be useful to draw the structure for HCO_2H.) What would have to happen for formic acid to be diprotic? How is that different...
-
1. Show two effects that have actually been experienced by Singapore, due to the collapse of US banks this year. Evidence should be given to prove the presence of each effect. 2. Analyse one factor...
-
In the US, the market for Ibuprofen is competitive with a large number of producers and consumers. Ibuprofen faces a lot of competition, in part, because there are many available substitutes, such as...
-
Directions: First, respond to the question below; Second, compose a multi-paragraph essay that has an average length of two hand-written pages; Third, plan to spend about one hour on the essay, being...
-
Here, again, are the GDP per capita numbers for a number of countries shown in class. But rather than focus on welfare now, let us consider the effects of differences in growth rates on how the GDP...
-
When Money Isn't Real: The $10,000 Experiment by Adam Carroll at TEDxLondonBusinessSchool (Transcript) 1.Provide a summary of the video. 2. Explain how you connected with the content in the video....
-
LTI Corp. purchased 500 shares as a short-term investment for $5,100 on January 4. The company received a 100% stock dividend on November 30. The market value of one share on December 31 was $6.30....
-
In Problems, solve each system of equations. x + 2y + 3z = 5 y + 11z = 21 5y + 9z = 13
-
Listing 6.7, PrimeNumberMethod.java, provides the isPrime(int number) method for testing whether a number is prime. Use this method to find the number of prime numbers less than 10000. Listing 1...
-
Recall that a graph is bipartite if its vertices can be divided into two disjoint sets such that no edges exist between vertices in the same set. Add a new method in AbstractGraph with the following...
-
Implement a class named BitOutputStream, as shown in Figure 17.22, for writing bits to an output stream. The writeBit(char bit) method stores the bit in a byte variable. When you create a...
-
A single-tank liquid-level system with inflow rate \(q_{i}\) as its input and liquid level \(h\) as its output is modeled as \(R A \dot{h}+g h=R q_{i}(t), h(0)=0\), where \(R, A, g=\) const. If the...
-
A dynamic system is modeled as \[4 \ddot{x}+4 \dot{x}+5 x=10 \sin \left(\frac{1}{2} t ight), \quad x(0)=\frac{1}{2}, \quad \dot{x}(0)=0\] Plot the response \(x(t)\) for \(0 \leq t \leq 20\) by a....
-
A nonlinear dynamic system is described by a. Use the Simulink model to plot x 2 ( t ) x 2 ( t ) . b. Derive the linearized model analytically, build its Simulink model where the linear model is...
Study smarter with the SolutionInn App