It keeps highlighting the line "super(r);" I can't find whats wrong with it.... The Error says: 1 error found:
File: C:\Documents and Settings\HP_Administrator\My Documents\Anna - java\Disk.java [line: 14]
Error: C:\Documents and Settings\HP_Administrator\My Documents\Anna - java\Disk.java:14: cannot find symbol
symbol : constructor Circle(double)
location: class Circle
The contructor code is:
/**
* Disk class.
*/
public class Disk extends Circle {
private double thickness;
/**
* constructor
* pre: none
* post: A disk object has been created with radius r
* and thickness t.
*/
public Disk(double r, double t) {
super(r);
thickness = t;
}
/**
* Changes the thickness of the disk
* pre: none
* post: thickness has been changed.
*/
public void setThickness(double newThickness) {
thickness = newThickness;
}
/**
* Returns the thickness of the disk
* pre: none
* post: The thickness of the disk has been returned.
*/
public double getThickness() {
return(thickness);
}
/**
* Returns the volumn of the disk.
* pre: none
* post: The volumn of the disk has been returned.
*/
public double volumn() {
double v;
v = super.area() * thickness;
return(v);
}
/**
* Determine if the object is equal to another
* Disk object.
* pre: d is a Disk object
* post: true has been returned if objects have the same
* readil and thickness. false has been returned otherwise.
*/
public boolean equals(Object d) {
Disk testObj = (Disk)d;
if (testObj.getRadius() == super.getRadius()
&& testObj.getThickness() == thickness) {
return(true);
} else {
return(false);
}
}
/**
* Returns a Sring that represents the disk object.
* pre: none
* post: A string representing the Disk object has
* been returned.
*/
public String toString() {
String diskString;
diskString = "The disk has radius " + super.getRadius()
+ " and thickness " + thickness + ".";
return(diskString);
}
}
The actual code is:
public class TestDisk {
public static void main(String[] args) {
Disk saucer = new Disk(10, 0.02);
System.out.println("Disk radius: " + saucer.getRadius());
System.out.println("Disk surface area: " + saucer.area());
System.out.println("Disk volumn: " + saucer.volumn());
Disk plate1 = new Disk(12, 0.05);
Disk plate2 = new Disk(12, 0.07);
if (plate1.equals(plate2)) {
System.out.println("Objects are equal ");
} else {
System.out.println("Objects are not equal ");
}
System.out.println(plate1);
System.out.println(plate2);
}
}