Question: Using Java Langauge, try to resolve this assignment. Please follow the instructions bellow. Point class>> The Main Instructions: That's all of the information that was

Using Java Langauge, try to resolve this assignment. Please follow the instructions bellow.
Using Java Langauge, try to resolve this assignment. Please follow the instructions
bellow. Point class>> The Main Instructions: That's all of the information that
Point class>>
was given to me! Part A. Write out the Triangle class from:
The Main Instructions:
Triangle side1: double side2: double - side3: double + Triangle () Triangle
That's all of the information that was given to me!

Part A. Write out the Triangle class from: Triangle side1: double side2: double - side3: double + Triangle () Triangle (s: double) + Triangle (s1: double, s2: double, s3: double) + setSides(s1: double, s2: double, s3: 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 O 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 ( l/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 //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)+ (21 - 22) 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) The contents of the file should include: o Triangle modified appropriately o Point modified appropriately o Scalable interface o Your test class including: . Main method that calls the other methods . Your sorting method Your method for creating the random array Your method for enlarging/shrinking objects

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!