subject

Public class: shapetests
package-visible class(es): octagon, triangle, illegaltriangleexception
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:
area = (2 + 4/ √ 2) ∗ side ∗ side
define the octagon class to have a private, double data field named side with its getter and setter methods.
define a no-arg constructor that creates an octagon with side 0, and a constructor to create an octagon with a specified side. implement the getarea and getperimeter methods, as is required.
define the triangle class derived from geometricobject to represent a geometric object with three sides. in a valid triangle, the sum of any two sides is greater than the other side. the triangle class must adhere to this rule. create the illegaltriangleexception class, and modify the constructor of the triangle class to throw an illegaltriangleexception object if a triangle is created with sides that violate the rule, as follows:
/** construct a triangle with the specified sides */
public triangle(double side1, double side2, double side3)
throws illegaltriangleexception {
// implement it }
implement the getarea and getperimeter methods for the triangle class, as is required.
draw a uml diagram that involves octagon, triangle, geometricobject, comparable, and cloneable. include a png of the class diagram as part of your submission.
finally, write a test program that creates an array geometricobject[] shapes containing 3 octagon objects and 3 triangle objects. create one of the octagon objects by calling the clone method on an existing octagon, and compare the two objects using the compareto method. write a loop that sums the area of all the geometric objects in the array by calling the overridden getarea method on each object.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:40
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
Which parts of a presentation should be the most general? a. introduction and conclusion b. introduction and outline c. outline and conclusion d. outline and body
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
You know the right answer?
Public class: shapetests
package-visible class(es): octagon, triangle, illegaltriangleexcept...
Questions
question
Mathematics, 23.03.2021 21:40
question
Mathematics, 23.03.2021 21:40
question
Mathematics, 23.03.2021 21:40
question
Chemistry, 23.03.2021 21:40
Questions on the website: 13722367