/** * Triangle.java * * Lab 8, COMP160 2020 * * Stores and displays information about an individual Book. */ public class Triangle{ /** * calculates the permieter of 3 triangles, given the coordinates for the three corners of each * Compute the length of a triangle's side by calculating the distance bwetween two points using the book formula * calculates the perimeter (perimeter of a triangle is the sum of the 3 distance calculations) * default constructor takes no parameters, and sets the data fields literally using the test data * 2nd constructor takes teh data in as parameters, and uses these to set the data field values * Triangle class has a method to calculate and return the length of one side using the distance fomula. Method should take 4 int values as parameteres, UML Diagram named. * Triangle class has a method to add the lengths of its 3 sides together and retrn the perimeter. This method will call the calcSide method 3 times, adding the length of the side each time * accessor method which returns the name of the triangle. * application nclass(triangleApp) should create the test Triangle object using the default constructor, and 2 futher triangle objects by sending co ordinate data to the constructor e.g., Triangle a = new Triangle(0,3,3,4,1,9,"A"); */ // data field declarations private static int[] test1 = {0,0}; private static int[] test2 = {3,0}; private static int[] test3 = {3,4}; private String name; private int point1; // private int point2; // private int point3; // /**sets the value of the data field title to input parameter value*/ public void setName(String n){ name = n; } /**sets the value of the data field title to input parameter value*/ public void setCoords(int c1, int c2, int c3){ point1 = c1; point2 = c2; point3 = c3; } /** constructor for Triangle given 0 arguments */ public Triangle() {} }//end class