Question

# missing something below which is preventing the code from running no errors using Netbeans but it will not run ,

any ideas ?

package TestPolygon;

/**

* CMIS 141

* Jonathan Warren

* February 2,2017

* Purpose: Write a Java test program, named TestPolygon, create 5 different polygons representing the 5 test

cases created. Create one using the no argument constructor.

*/

public class TestPolygon{

public static void main(String[] args) {

//Make a polygon with defau construct

Polygon defauPolygon = new Polygon();

//Construct polygon #2

Polygon polygonTwo = new Polygon(5, 4.0, 3.0, 2.0, 1.5, 25.0);

//Construct polygon #3

Polygon polygonThree = new Polygon(10, 10.0, 3.5, 3.5, 7.0, 40.0);

//Construct polygon #4

Polygon polygonFour = new Polygon(4, 2.0, 2.0, 3.0, 1.5, 5.0);

//Construct polygon #5

Polygon polygonFive = new Polygon(7, 7.0, 7.5, 7.5, 2.0, 11.0);

//Defau Polygon

System.out.println(Defau polygon data);

//Get methods for defau

int defauPolygonSides = defauPolygon.getSides();

System.out.println(Defau polygon has # sides: + defauPolygonSides);

double defauPolygonLength = defauPolygon.getLength();

System.out.println(Defau polygon has side length: + defauPolygonLength);

double defauPolygonX = defauPolygon.getX();

System.out.println(Defau polygon has X Coordinate: + defauPolygonX);

double defauPolygonY = defauPolygon.getY();

System.out.println(Defau polygon has Y Coordinate: + defauPolygonY);

double defauPolygonApothem = defauPolygon.getApothem();

System.out.println(Defau polygon has apothem: + defauPolygonApothem);

double defauPolygonPerimeter = defauPolygon.getPerimeter(defauPolygonSides, defauPolygonLength);

System.out.println(Defau polygon has perimeter: + defauPolygonPerimeter);

double defauPolygonArea = defauPolygon.getArea(defauPolygonApothem, defauPolygonPerimeter);

System.out.println(Defau polygon has area: + defauPolygonArea);

//To string method

String defauPolygonString = defauPolygon.toString();

System.out.println(defauPolygonString);

//Set methods for defau

defauPolygon.setSides(5);

defauPolygonSides = defauPolygon.getSides();

System.out.println(Defau polygon now has # sides: + defauPolygonSides);

defauPolygon.setLength(11);

defauPolygonLength = defauPolygon.getLength();

System.out.println(Defau polygon now has side length: + defauPolygonLength);

defauPolygon.setX(1.0);

defauPolygonX = defauPolygon.getX();

System.out.println(Defau polygon now has X Coordinate: + defauPolygonX);

defauPolygon.setY(1.0);

defauPolygonY = defauPolygon.getY();

System.out.println(Defau polygon now has Y Coordinate: + defauPolygonY);

defauPolygon.setApothem(5.5);

defauPolygonApothem = defauPolygon.getApothem();

System.out.println(Defau polygon now has apothem: + defauPolygonApothem);

defauPolygonPerimeter = defauPolygon.getPerimeter(defauPolygonSides, defauPolygonLength);

System.out.println(Defau polygon now has perimeter: + defauPolygonPerimeter);

defauPolygonArea = defauPolygon.getArea(defauPolygonApothem, defauPolygonPerimeter);

System.out.println(Defau polygon now has area: + defauPolygonArea);

// Second Polygon

System.out.println();

System.out.println(Polygon #2 data);

//Get methods for polygon #2

int polygonTwoSides = polygonTwo.getSides();

System.out.println(Polygon #2 has # sides: + polygonTwoSides);

double polygonTwoLength = polygonTwo.getLength();

System.out.println(Polygon #2 has side length: + polygonTwoLength);

double polygonTwoX = polygonTwo.getX();

System.out.println(Polygon #2 has X Coordinate: + polygonTwoX);

double polygonTwoY = polygonTwo.getY();

System.out.println(Polygon #2 has Y Coordinate: + polygonTwoY);

double polygonTwoApothem = polygonTwo.getApothem();

System.out.println(Polygon #2 has apothem: + polygonTwoApothem);

double polygonTwoPerimeter = polygonTwo.getPerimeter(polygonTwoSides, polygonTwoLength);

System.out.println(Polygon #2 has perimeter: + polygonTwoPerimeter);

double polygonTwoArea = polygonTwo.getArea(polygonTwoApothem, polygonTwoPerimeter);

System.out.println(Polygon #2 has area: + polygonTwoArea);

//To string method

String polygonTwoString = polygonTwo.toString();

System.out.println(polygonTwoString);

//Set methods for polygon #2

polygonTwo.setSides(5);

polygonTwoSides = polygonTwo.getSides();

System.out.println(Polygon #2 now has # sides: + polygonTwoSides);

polygonTwo.setLength(11);

polygonTwoLength = polygonTwo.getLength();

System.out.println(Polygon #2 now has side length: + polygonTwoLength);

polygonTwo.setX(1.0);

polygonTwoX = polygonTwo.getX();

System.out.println(Polygon #2 now has X Coordinate: + polygonTwoX);

polygonTwo.setY(1.0);

polygonTwoY = polygonTwo.getY();

System.out.println(Polygon #2 now has Y Coordinate: + polygonTwoY);

polygonTwo.setApothem(5.5);

polygonTwoApothem = polygonTwo.getApothem();

System.out.println(Polygon #2 now has apothem: + polygonTwoApothem);

polygonTwoPerimeter = polygonTwo.getPerimeter(polygonTwoSides, polygonTwoLength);

System.out.println(Polygon #2 now has perimeter: + polygonTwoPerimeter);

polygonTwoArea = polygonTwo.getArea(polygonTwoApothem, polygonTwoPerimeter);

System.out.println(Polygon #2 now has area: + polygonTwoArea);

//Polygon #3

System.out.println();

System.out.println(Polygon #3 data);

//Get methods for polygon #3

int polygonThreeSides = polygonThree.getSides();

System.out.println(Polygon #3 has # sides: + polygonThreeSides);

double polygonThreeLength = polygonThree.getLength();

System.out.println(Polygon #3 has side length: + polygonThreeLength);

double polygonThreeX = polygonThree.getX();

System.out.println(Polygon #3 has X Coordinate: + polygonThreeX);

double polygonThreeY = polygonThree.getY();

System.out.println(Polygon #3 has Y Coordinate: + polygonThreeY);

double polygonThreeApothem = polygonThree.getApothem();

System.out.println(Polygon #3 has apothem: + polygonThreeApothem);

double polygonThreePerimeter = polygonThree.getPerimeter(polygonThreeSides, polygonThreeLength);

System.out.println(Polygon #3 has perimeter: + polygonThreePerimeter);

double polygonThreeArea = polygonThree.getArea(polygonThreeApothem, polygonThreePerimeter);

System.out.println(Polygon #3 has area: + polygonThreeArea);

//To string method

String polygonThreeString = polygonThree.toString();

System.out.println(polygonThreeString);

//Set methods for polygon #3

polygonThree.setSides(5);

polygonThreeSides = polygonThree.getSides();

System.out.println(Polygon #3 now has # sides: + polygonThreeSides);

polygonThree.setLength(11);

polygonThreeLength = polygonThree.getLength();

System.out.println(Polygon #3 now has side length: + polygonThreeLength);

polygonThree.setX(1.0);

polygonThreeX = polygonThree.getX();

System.out.println(Polygon #3 now has X Coordinate: + polygonThreeX);

polygonThree.setY(1.0);

polygonThreeY = polygonThree.getY();

System.out.println(Polygon #3 now has Y Coordinate: + polygonThreeY);

polygonThree.setApothem(5.5);

polygonThreeApothem = polygonThree.getApothem();

System.out.println(Polygon #3 now has apothem: + polygonThreeApothem);

polygonThreePerimeter = polygonThree.getPerimeter(polygonThreeSides, polygonThreeLength);

System.out.println(Polygon #3 now has perimeter: + polygonThreePerimeter);

polygonThreeArea = polygonThree.getArea(polygonThreeApothem, polygonThreePerimeter);

System.out.println(Polygon #3 now has area: + polygonThreeArea);

//Polygon #4

System.out.println();

System.out.println(Polygon #4 data);

//Get methods for Polygon #4

int polygonFourSides = polygonFour.getSides();

System.out.println(Polygon #4 has # sides: + polygonFourSides);

double polygonFourLength = polygonFour.getLength();

System.out.println(Polygon #4 has side length: + polygonFourLength);

double polygonFourX = polygonFour.getX();

System.out.println(Polygon #4 has X Coordinate: + polygonFourX);

double polygonFourY = polygonFour.getY();

System.out.println(Polygon #4 has Y Coordinate: + polygonFourY);

double polygonFourApothem = polygonFour.getApothem();

System.out.println(Polygon #4 has apothem: + polygonFourApothem);

double polygonFourPerimeter = polygonFour.getPerimeter(polygonFourSides, polygonFourLength);

System.out.println(Polygon #4 has perimeter: + polygonFourPerimeter);

double polygonFourArea = polygonFour.getArea(polygonFourApothem, polygonFourPerimeter);

System.out.println(Polygon #4 has area: + polygonFourArea);

//To string method

String polygonFourString = polygonFour.toString();

System.out.println(polygonFourString);

//Set methods for polygon #4

polygonFour.setSides(5);

polygonFourSides = polygonFour.getSides();

System.out.println(Polygon #4 now has # sides: + polygonFourSides);

polygonFour.setLength(11);

polygonFourLength = polygonFour.getLength();

System.out.println(Polygon #4 now has side length: + polygonFourLength);

polygonFour.setX(1.0);

polygonFourX = polygonFour.getX();

System.out.println(Polygon #4 now has X Coordinate: + polygonFourX);

polygonFour.setY(1.0);

polygonFourY = polygonFour.getY();

System.out.println(Polygon #4 now has Y Coordinate: + polygonFourY);

polygonFour.setApothem(5.5);

polygonFourApothem = polygonFour.getApothem();

System.out.println(Polygon #4 now has apothem: + polygonFourApothem);

polygonFourPerimeter = polygonFour.getPerimeter(polygonFourSides, polygonFourLength);

System.out.println(Polygon #4 now has perimeter: + polygonFourPerimeter);

polygonFourArea = polygonFour.getArea(polygonFourApothem, polygonFourPerimeter);

System.out.println(Polygon #4 now has area: + polygonFourArea);

//Polygon #5

System.out.println();

System.out.println(Polygon #5 data);

//Get methods for Polygon #5

int polygonFiveSides = polygonFive.getSides();

System.out.println(Polygon #5 has # sides: + polygonFiveSides);

double polygonFiveLength = polygonFive.getLength();

System.out.println(Polygon #5 has side length: + polygonFiveLength);

double polygonFiveX = polygonFive.getX();

System.out.println(Polygon #5 has X Coordinate: + polygonFiveX);

double polygonFiveY = polygonFive.getY();

System.out.println(Polygon #5 has Y Coordinate: + polygonFiveY);

double polygonFiveApothem = polygonFive.getApothem();

System.out.println(Polygon #5 has apothem: + polygonFiveApothem);

double polygonFivePerimeter = polygonFive.getPerimeter(polygonFiveSides, polygonFiveLength);

System.out.println(Polygon #5 has perimeter: + polygonFivePerimeter);

double polygonFiveArea = polygonFive.getArea(polygonFiveApothem, polygonFivePerimeter);

System.out.println(Polygon #5 has area: + polygonFiveArea);

//To string method

String polygonFiveString = polygonFive.toString();

System.out.println(polygonFiveString);

//Set methods for polygon #5

polygonFive.setSides(5);

polygonFiveSides = polygonFive.getSides();

System.out.println(Polygon #5 now has # sides: + polygonFiveSides);

polygonFive.setLength(11);

polygonFiveLength = polygonFive.getLength();

System.out.println(Polygon #5 now has side length: + polygonFiveLength);

polygonFive.setX(1.0);

polygonFiveX = polygonFive.getX();

System.out.println(Polygon #5 now has X Coordinate: + polygonFiveX);

polygonFive.setY(1.0);

polygonFiveY = polygonFive.getY();

System.out.println(Polygon #5 now has Y Coordinate: + polygonFiveY);

polygonFive.setApothem(5.5);

polygonFiveApothem = polygonFive.getApothem();

System.out.println(Polygon #5 now has apothem: + polygonFiveApothem);

polygonFivePerimeter = polygonFive.getPerimeter(polygonFiveSides, polygonFiveLength);

System.out.println(Polygon #5 now has perimeter: + polygonFivePerimeter);

polygonFiveArea = polygonFive.getArea(polygonFiveApothem, polygonFivePerimeter);

System.out.println(Polygon #5 now has area: + polygonFiveArea);

}

}

Engineering Technology