Java Assignment 10 - Pseudo Polygons

Feb 3rd, 2012
Studypool Tutor
Price: $15 USD

Tutor description

In elementary mathematics of 2-dimensions, each point on the plane (or paper or screen, if you like) can be represented by a pair of numbers, (x, y), where x tells you the horizontal location of the point and y tells you the vertical location. The values are relative to some "origin" (0,0). So (3.1, 0) is the point 3.1 units to the right of the origin, and (-3.6, 5) is the point 3.6 units to the leftof the origin and 5 units above it. This allows us to label every point in the plane with a unique (x,y) coordinate pair. The two numbers, x and y, are called the coordinates of the point. Create a class called Point that has the following private members: float x - the x-coordinate of the point. float y - the y-coordinate of the point. Point should also contain private static float MIN_VAL and MAX_VAL - which are initialized to -10.0 and +10.0, respectively. These will represent the legal range of both the x and y coordinates for all Points in the class. It is important that these be static

Word Count: 501
Showing Page: 1/4
/** * Created by poope on 16-Jul-14. */public class Foothill { public static void main(String args[]) { System.out.println("*** Setting the points range to -10 - 20"); Point.setRange(-10, 20); System.out.println("*** Testing the point class now for 10, 15"); Point p1 = new Point(10, 15); System.out.println("*** Testing the point class now for -11, 15"); Point p2 = new Point(-11, 15); System.out.println("*** Testing the point class now for -4, 25"); Point p3 = new Point(-4, 25); System.out.println("** Creating three polygon instances"); Polygon polygon1 = new Polygon(3, new float[]{-5, 0, 10}, new float[]{-1, 1, 11}); Polygon polygon2 = new Polygon(4, new float[]{-6, 1, 11, 12, 13}, new float[]{-2, 2, 12, 12, 15}); Polygon polygon3 = new Polygon(); polygon3.setPoints(5, new float[]{-7, 2, 12, 4, 6}, new float[]{-3, 3, 13, 10, 20}); System.out.println("** Showing the 3 polygon instances"); polygon1.showPolygon(); polygon2.showPolygon(); polygon3.showPolygon(); System.out.println("** Modifying the 3 pol

Review from student

Studypool Student
" Got a couple of mistakes which brought me down to a B+, but still overall very pleased. Great stuff. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1830 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors