{"id":109299,"date":"2022-12-09T22:07:39","date_gmt":"2022-12-09T22:07:39","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/a-private-double-data-field-named-sidelength-that-defines-the-length\/"},"modified":"2022-12-09T22:07:39","modified_gmt":"2022-12-09T22:07:39","slug":"a-private-double-data-field-named-sidelength-that-defines-the-length","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/a-private-double-data-field-named-sidelength-that-defines-the-length\/","title":{"rendered":"A private double data field named sidelength that defines the length"},"content":{"rendered":"<div>\n<p>A private double data field named sideLength that defines the length of each side.<span>\u00b7<\/span> A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4. <span>\u00b7<\/span>Design a Java class named Polygon that contains: <br \/>\u00a0A private double data field named yCoord that defines the y-coordinate of the center<span>\u00b7<\/span> A private double data field named xCoord that defines the x-coordinate of the center of the polygon. The default value should be 0.0. <span>\u00b7<\/span>The default value should be 10.0. <br \/>\u00a0A private double data filed named perimeter that defines the perimeter of the polygon. The<span>\u00b7<\/span> A private double data field named apothem that defines the apothem of the polygon. The default value should 5.0. <span>\u00b7<\/span>of the polygon. The default value should be 0.0. <br \/>\u00a0A constructor that creates a Polygon using a specified number of<span>\u00b7<\/span> A no argument constructor that creates a Polygon using the default number of sides, default side length, default x- and y-coordinates, and the default apothem. <span>\u00b7<\/span>default value should 20.0. <br \/>\u00a0Getter and setter methods for all<span>\u00b7<\/span> A getArea() method that returns a double value representing the area of the polygon. (Note the area of a regular Polgon can be calculated from \u00bd * Apothem*Perimeter) <span>\u00b7<\/span>sides, side length, xand y-coordinates and the apothem <br \/>\u00a0A toString() method that displays the number of sides, side length, x-coordinate, ycoordinate and apothem values in String format Be sure your code compiles. Next, write a Java test program, named TestPolygon, to create five different polygons.<span>\u00b7<\/span>data fields <br \/>When creating the five polygons, create one using the no argument constructor. For the remaining four, feel free to use any number of sides, side length and x-, and y-coordinates and apothem that are not equal to the default values and not equal to each other.<br \/>For each of the five polygons, call all of the methods and display the results. For example for a Polygon with 3 sides, side length of 2.0 and xcoordinate and y-coordinates of 1.0, and apothem of 1.0 the following output may result: toString() results: (numsides=3,<br \/>sideLength=2.0, xcoord=1.0,ycoord=1.0, apothem=1.0) getNumSides() results: 3 getSideLength() results: 2.0 getXCoord() results: 0.0 getYCoord() results: 0.0 getApothem() results:1.0 getPerimeter() results: 6.0 getArea() results: 3.0 setNumSides(4) results:<br \/>4 setSideLength(3) results: 3.0 setXCoord(2.0) results: 2.0 setYCoord(2.0) results: 2.0 setApothem(2.0) results:2.0 Keep in mind, for five Polygons, you will have five different output results. Also, note there is no requirement to actually draw a Polygon<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A private double data field named sideLength that defines the length of each side.\u00b7 A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4. \u00b7Design a Java class named Polygon that contains: \u00a0A private double data field named yCoord that defines the y-coordinate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-109299","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/109299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=109299"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/109299\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=109299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=109299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=109299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}