Αποτελέσματα Αναζήτησης
/** creates a regular polygon with the specified number /* of sides, length of side, and x- and y-coordinates */ RegularPolygon(int newN, double newSide, double newX, double newY) {
The formula for computing the area of a regular polygon is * Area=n s24 tan (n). * <p> * Draw the UML diagram for the class and then implement the class. * <p> * Write a test program that creates three RegularPolygon objects, * created using the no-arg constructor, using RegularPolygon (6, 4), * and using RegularPolygon (10, 4, 5.6, 7.8).
RegularPolygon.java. ChrisMayfield. ch17 revisions. 4e05ec0 · 4 years ago. History. Code. Blame. 70 lines (60 loc) · 2.07 KB. import java.awt.Color; /** * A polygon that is equiangular (all angles are equal in measure) and * equilateral (all sides have the same length).
16 Δεκ 2012 · In order to turn your polygon by X degrees, convert X to radians, and add the result to the angle in the formula, like this: (2*Math.PI*K)/N + Xrad. Finally, since the origin of the screen is in one of the corners, only a portion of your polygon is going to be visible.
8 Μαΐ 2018 · We can draw Polygon in java applet by three ways : drawPolygon(int[] x, int[] y, int numberofpoints) : draws a polygon with the given set of x and y points. // Java program to draw polygon using
You are going to have to figure out the angle for each corner, which would be the same for each in a regular polygon. Then how long you want each side to be. Then run a for loop to add all points to the polygon object. Take a look at this example.
/* (Geometry: area of a regular polygon) A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular).