Question: The following code has 10 unique errors. For all 10 errors below, type the line that contains the error, state what the error is and
The following code has 10 unique errors. For all 10 errors below, type the line that contains the error, state what the error is and explain how to fix it. Assume each class is in it's own file. There are 5 errors in each class.
public class Circle{}
private double radius;
private double PI 3.14;
public Circle(){
radius = 1
}
public Circle(double r) {
r = radius;
}
public double getArea() {
PI*radius*radius;
}
public
void tostring() {
return "Radius: " + radius;
}
public class Disk inherits Circle {
public double
height;
public Disk(double r, double h) {
height = 1;
super(r);
}
public Disk(double r, double h) {
super(r);
height = h;
}
public void setHeight(double h) {
height = h;
}
public double getHeight() {
return height;
}
public double getVolume() {
return getArea() *height;
}
public String toString() {
return super.tostring() + "Disk has a thickness of + height;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
