I was unable to build the program properly due to some errors:
Program is:
package Octagon;
import javax.swing.JOptionPane;
public class Octagon extends GeometricObject implements Cloneable , Comparable{
private double size;
public Octagon()
{this.size = 1.0;}
public Octagon(double size)
{this.size = size ;}
public double getArea()
{return (2.0 + 4.0/Math.pow(2,0.5)) * this.size * this.size;}
public double getPerimeter()
{return 8.0 * this.size;
}
public int compareTo(Object o)
{if (getArea()>o.getArea())
return 1;
else if(o.getArea() > getArea())
return -1;
else
return 0;
}
public Object clone() throws CloneNotSupportedException
{return super.clone();
}
public static void main(String[] args)
{
Octagon sample = new Octagon(5.0) ;
double Area = sample.getArea();
double Perimeter = sample.getPerimeter();
String output = ("Area of regular octagon of side 5.0 = " + Area + "\nand it's perimeter = " + Perimeter);
JOptionPane.showMessageDialog(null, output);
}
And the error is as shown below:
error: cannot find symbol
public class Octagon extends GeometricObject implements Cloneable , Comparable{
symbol: class GeometricObject
C:\Users\User\Documents\NetBeansProjects\Octagon\nbproject\build-impl.xml:926: The following error occurred while executing this line:
C:\Users\User\Documents\NetBeansProjects\Octagon\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
I am running this program in Netbeans 7.3.1
GeometricObject is an abstract class which I built on GeometricObject.java with getArea() and getPerimeter() as abatract methods.
What is wrong in the given program?
If anyboby will solve it,it would be great.
my e-mail ID is shreyaskj10@gmail.com