Hey guys, I am trying to get a test program to run in the same application that my class is in... I seem to be having some trouble with it.
Could you please advise, I have everything done I just can't figure this part out.
Thanks in advance for your time.
public class RegularPolygon { private int n; private double side; private double x; private double y; public RegularPolygon() { n = 3; side = 1; x = y = 0; } public RegularPolygon(int n, double side) { this.n = n; this.side = side; x = y = 0; } public RegularPolygon(int n, double side, double x, double y) { this.n = n; this.side = side; this.x = x; this.y = y; } public void setN(int n) { this.n = n; } public int getN() { return n; } public void setSide(double side) { this.side = side; } public double getSide() { return side; } public void setX(double x) { this.x = x; } public double getX() { return x; } public void setY() { this.y = y; } public double getY() { return y; } public double getPerimeter() { return n * side; } public double getArea() { return (n * side) * 5; } } public static void main(String[] args) { RegularPolygon test1 = new RegularPolygon(); RegularPolygon test2 = new RegularPolygon(6, 4); RegularPolygon test3 = new RegularPolygon(10, 4, 5.6, 7.8); System.out.println(test1.getPerimeter()+"\t"+test1.getArea(); System.out.println(test2.getPerimeter()+"\t"+test2.getArea(); System.out.println(test3.getPerimeter()+"\t"+test3.getArea(); }