Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

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

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 default construct

Polygon defaultPolygon = 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);

//Default Polygon

System.out.println("Default polygon data");

//Get methods for default

int defaultPolygonSides = defaultPolygon.getSides();

System.out.println("Default polygon has # sides: " + defaultPolygonSides);

double defaultPolygonLength = defaultPolygon.getLength();

System.out.println("Default polygon has side length: " + defaultPolygonLength);

double defaultPolygonX = defaultPolygon.getX();

System.out.println("Default polygon has X Coordinate: " + defaultPolygonX);

double defaultPolygonY = defaultPolygon.getY();

System.out.println("Default polygon has Y Coordinate: " + defaultPolygonY);

double defaultPolygonApothem = defaultPolygon.getApothem();

System.out.println("Default polygon has apothem: " + defaultPolygonApothem);

double defaultPolygonPerimeter = defaultPolygon.getPerimeter(defaultPolygonSides, defaultPolygonLength);

System.out.println("Default polygon has perimeter: " + defaultPolygonPerimeter);

double defaultPolygonArea = defaultPolygon.getArea(defaultPolygonApothem, defaultPolygonPerimeter);

System.out.println("Default polygon has area: " + defaultPolygonArea);

//To string method

String defaultPolygonString = defaultPolygon.toString();

System.out.println(defaultPolygonString);

//Set methods for default

defaultPolygon.setSides(5);

defaultPolygonSides = defaultPolygon.getSides();

System.out.println("Default polygon now has # sides: " + defaultPolygonSides);

defaultPolygon.setLength(11);

defaultPolygonLength = defaultPolygon.getLength();

System.out.println("Default polygon now has side length: " + defaultPolygonLength);

defaultPolygon.setX(1.0);

defaultPolygonX = defaultPolygon.getX();

System.out.println("Default polygon now has X Coordinate: " + defaultPolygonX);

defaultPolygon.setY(1.0);

defaultPolygonY = defaultPolygon.getY();

System.out.println("Default polygon now has Y Coordinate: " + defaultPolygonY);

defaultPolygon.setApothem(5.5);

defaultPolygonApothem = defaultPolygon.getApothem();

System.out.println("Default polygon now has apothem: " + defaultPolygonApothem);

defaultPolygonPerimeter = defaultPolygon.getPerimeter(defaultPolygonSides, defaultPolygonLength);

System.out.println("Default polygon now has perimeter: " + defaultPolygonPerimeter);

defaultPolygonArea = defaultPolygon.getArea(defaultPolygonApothem, defaultPolygonPerimeter);

System.out.println("Default polygon now has area: " + defaultPolygonArea);

// 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);

}

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question