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 23:00
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
question
Computers and Technology, 22.06.2019 23:50
You need to design a circuit that implements the functions in the following table: s0 s1 function0 0 a + 10 1 a – b1 0 a + b1 1 a – 1s0 and s1 are 1-bit control inputs to select the function of the circuit. inputs a and b are 4-bitnumbers in 2s complement form. the output is also a 4-bit number in 2s complement form.you are allowed to use only one ttl 7483 4-bit adder to implement all the functions. but anynumber of other components (except the adder) can be used.hint: design a combinational logic circuit to modify the input b and the “carry input” of theadder depending on the control inputs s0 and s1.important: lab grade will depend on the working of the circuit & will be checked of by your labinstructor.1. is the output valid for the following input combinations: a. s0 = 0, s1 = 0, a = 7, b = 3? b. s0 = 0, s1 = 1, a = 7, b = 3? c. s0 = 1, s1 = 0, a = -4, b = -5? d. s0 = 1, s1 = 1, a = -8, b = 6? 2. what is the range of inputs (for both a and b) that will produce the valid output for all the functions?
Answers: 3
question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
question
Computers and Technology, 24.06.2019 10:10
Scanning the road can be thought of as a
Answers: 2
You know the right answer?
Public class: shapetests
package-visible class(es): octagon, triangle, illegaltriangleexcept...
Questions
question
Biology, 12.10.2020 22:01
question
Mathematics, 12.10.2020 22:01
question
Mathematics, 12.10.2020 22:01
question
Mathematics, 12.10.2020 22:01
question
Biology, 12.10.2020 22:01
question
English, 12.10.2020 22:01
question
Mathematics, 12.10.2020 22:01
Questions on the website: 13722360