Question: Using java language for this assignment. Please only show the test class I attached all of the required information Part A Write out the Triangle

Using java language for this assignment. Please only show the test class
Using java language for this assignment. Please only show the test class
I attached all of the required information Part A Write out the
Triangle class from: Triangle sidel: double side2: double side3: double - +
I attached all of the required information

Part A Write out the Triangle class from: Triangle sidel: double side2: double side3: double - + + + + + + + + Triangle (0) Triangle (s: double) Triangle (s1: double, s2: double, s3: double) setSides(s1: double, s2: double, 53: double) getSides(): double ] toString(): String area(): double equals(t : Triangle): boolean Make Triangle implement the comparable interface. These objects should be ordered based on area. Write a sorting method for an array of these objects. (Use selection or insertion sort only). Part B. Make an interface that is called Scalable. It should have two functions: the ability to enlarge or shrink an object. Make Triangle Scalable Using Point class from lab 4, make Points Scalable as well. (You may ignore the z values if you want) For both classes, provide an explanation for your enlarge and shrink methods implementation. Part C. Create an array of random Triangles and Points. (There should be a random mixture of all the objects) o Random points should be generated using random integers values from the interval (-50,50] for both x and y values. (You may just keep z values as default 0 values.) o Random Triangles should be created by generating two random integers in the interval [1,100], say x and y. From these values for the sides are computed as: . x2 - y2 - 2xy . x2 + y2 Write a method to go through the array and : enlarge a Point if it's within distance of 20 from the origin, otherwise shrink the Point. enlarge a Triangle if its area is less than the average area of all the Triangles in the array and shrink it otherwise. Point - - - X: int y:int z: int + Point //should create the origin (0,0) + Point (x: int, y:int) //should create (x,y,0) + Point (x: int, y:int, z: int) //should create (x,y,z) + distance (Point p) : double //should return the distance between the 2 points + distance From Origin (): double l/should return the distance from (0,0) + toString(): String //should return the point in the form "(x,y,z)" + equals (Point p): boolean 1/2 points are equal if x, y,z values are all equal + translate (x: int, y:int) : Point + translate (x : int, y: int, z: int) : Point (Hint: remember to add the get and set methods) Distance between two points is: (x1 - x2)2 + (y1 - y2)2 + (21 - 2)2 Translating a point is: creating a new point where the x value is the x of the original point plus the parameter, similarly for y and z. Ex. P =(3, -6) and we want to use translate (1, 2) then we should get P2 =(4,-4)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!