30 /** * A class to represent a triangle defined by the x- and y-coorindates of its * three corner points 4 7 public class Triangle { 8 9. // ADD YOUR INSTANCE VARIABLES HERE 10 110 /** 12 *...


Java. Please use the template, thank you!


30 /**<br>* A class to represent a triangle defined by the x- and y-coorindates of its<br>* three corner points<br>4<br>7 public class Triangle {<br>8<br>9.<br>// ADD YOUR INSTANCE VARIABLES HERE<br>10<br>110<br>/**<br>12<br>* Constructs a triangle with the given corner points<br>*<br>13<br>* @param x1 x-value of corner point 1<br>* @param y1 y-value of corner point 1<br>* @param x2 x-value of corner point 2<br>* @param y2 y-value of corner point 2<br>* @param x3 x-value of corner point 3<br>* @param y3 y-value of corner point 3<br>*/<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>public Triangle(double x1, double y1, double x2, double y2, double x3, double y3) {<br>// FILL IN<br>}<br>210<br>22<br>23<br>24<br>25<br>260<br>/**<br>27<br>* Returns the length of side 1: (x1, y1) to (x2, y2)<br>*<br>28<br>@return the length of side 1<br>*/<br>*<br>29<br>30<br>public double getSide1Length() {<br>return -1.0; // FIX ME<br>}<br>310<br>32<br>33<br>34<br>35<br>**<br>360<br>37<br>* Returns the length of side 2: (x1, y1) to (x3, y3)<br>*<br>38<br>* @return the length of side 2<br>*/<br>39<br>40<br>public double getSide2Length() {<br>return -1.0; // FIX ME<br>410<br>42<br>43<br>}<br>44<br>45<br>460<br>/**<br>47<br>* Returns the length of side 3: (x2, y2) to (x3, y3)<br>48<br>@return the length of side 3<br>*/<br>public double getSide3Length() {<br>return -1.0; // FIX ME<br>}<br>49<br>50<br>510<br>52<br>53<br>54<br>55<br>560<br>/**<br>57<br>* Returns the angle at corner 1 (x1, y1)<br>58<br>* @return the angle at corner 1<br>*/<br>59<br>60<br>public double getAngle1() {<br>return -1.0; // FIX ME<br>}<br>610<br>62<br>63<br>64<br>65<br>/**<br>* Returns the angle at corner 2 (x2, y2)<br>660<br>67<br>68<br>*<br>@return the angle at corner 2<br>*/<br>69<br>70<br>public double getAngle2() {<br>return -1.0; // FIX ME<br>}<br>710<br>72<br>73<br>74<br>75<br>760<br>/**<br>77<br>* Returns the angle at corner 3 (x3, y3)<br>78<br>*<br>@return the angle at corner 3<br>* /<br>79<br>80<br>public double getAngle3() {<br>return -1.0; // FIX ME<br>}<br>810<br>82<br>83<br>84<br>85<br>860<br>/**<br>87<br>* Returns the perimeter of the triangle<br>88<br>@return the perimeter of the triangle<br>*/<br>89<br>90<br>public double getPerimeter() {<br>return -1.0; // FIX ME<br>}<br>910<br>92<br>93<br>94<br>95<br>960<br>/**<br>97<br>Returns the area of the triangle<br>*<br>98<br>*<br>@return the area of the triangle<br>*/<br>99<br>L00<br>L010<br>public double getArea() {<br>return -1.0; // FIX ME<br>}<br>L02<br>L03<br>L04 }<br>

Extracted text: 30 /** * A class to represent a triangle defined by the x- and y-coorindates of its * three corner points 4 7 public class Triangle { 8 9. // ADD YOUR INSTANCE VARIABLES HERE 10 110 /** 12 * Constructs a triangle with the given corner points * 13 * @param x1 x-value of corner point 1 * @param y1 y-value of corner point 1 * @param x2 x-value of corner point 2 * @param y2 y-value of corner point 2 * @param x3 x-value of corner point 3 * @param y3 y-value of corner point 3 */ 14 15 16 17 18 19 20 public Triangle(double x1, double y1, double x2, double y2, double x3, double y3) { // FILL IN } 210 22 23 24 25 260 /** 27 * Returns the length of side 1: (x1, y1) to (x2, y2) * 28 @return the length of side 1 */ * 29 30 public double getSide1Length() { return -1.0; // FIX ME } 310 32 33 34 35 ** 360 37 * Returns the length of side 2: (x1, y1) to (x3, y3) * 38 * @return the length of side 2 */ 39 40 public double getSide2Length() { return -1.0; // FIX ME 410 42 43 } 44 45 460 /** 47 * Returns the length of side 3: (x2, y2) to (x3, y3) 48 @return the length of side 3 */ public double getSide3Length() { return -1.0; // FIX ME } 49 50 510 52 53 54 55 560 /** 57 * Returns the angle at corner 1 (x1, y1) 58 * @return the angle at corner 1 */ 59 60 public double getAngle1() { return -1.0; // FIX ME } 610 62 63 64 65 /** * Returns the angle at corner 2 (x2, y2) 660 67 68 * @return the angle at corner 2 */ 69 70 public double getAngle2() { return -1.0; // FIX ME } 710 72 73 74 75 760 /** 77 * Returns the angle at corner 3 (x3, y3) 78 * @return the angle at corner 3 * / 79 80 public double getAngle3() { return -1.0; // FIX ME } 810 82 83 84 85 860 /** 87 * Returns the perimeter of the triangle 88 @return the perimeter of the triangle */ 89 90 public double getPerimeter() { return -1.0; // FIX ME } 910 92 93 94 95 960 /** 97 Returns the area of the triangle * 98 * @return the area of the triangle */ 99 L00 L010 public double getArea() { return -1.0; // FIX ME } L02 L03 L04 }
Implement a class Triangle. A Triangle is defined by the x- and y- coordinates of its three corner<br>points.<br>Your job is to compute the following properties of a given triangle:<br>the lengths of all sides (methods getSidelLength, getSide2Length, getSide3Length)<br>• the angles at all corners (methods getAnglel, getAngle2, getAngle3)<br>• the perimeter (the getPerimeter method)<br>• the area (the getArea method)<br>Implement a Triangle class using the template provided here: Triangle.java<br>Example:<br>Triangle triangle = new Triangle (0, 5, 1.5, 2, 8, 25.92);<br>triangle.getSidelLength(); // 3.3541019662496847<br>triangle.getSide2Length (); // 22.39746414217467<br>triangle.getSide3Length (); // 24.787424230847385<br>triangle.getAnglel (); // 2.312694531902217<br>triangle.getAngle2 (); // 0.7289796952097912<br>triangle.getAngle3 (); // 0.09991842647778622<br>triangle.getPerimeter(); // 50.53899033927174<br>triangle.getArea (); // 27.690000000000044<br>

Extracted text: Implement a class Triangle. A Triangle is defined by the x- and y- coordinates of its three corner points. Your job is to compute the following properties of a given triangle: the lengths of all sides (methods getSidelLength, getSide2Length, getSide3Length) • the angles at all corners (methods getAnglel, getAngle2, getAngle3) • the perimeter (the getPerimeter method) • the area (the getArea method) Implement a Triangle class using the template provided here: Triangle.java Example: Triangle triangle = new Triangle (0, 5, 1.5, 2, 8, 25.92); triangle.getSidelLength(); // 3.3541019662496847 triangle.getSide2Length (); // 22.39746414217467 triangle.getSide3Length (); // 24.787424230847385 triangle.getAnglel (); // 2.312694531902217 triangle.getAngle2 (); // 0.7289796952097912 triangle.getAngle3 (); // 0.09991842647778622 triangle.getPerimeter(); // 50.53899033927174 triangle.getArea (); // 27.690000000000044
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here