so i have to create a java program that calculates the diameter and area of a circle using methods: setRadius()and getRadius(). The setRadius() also has to be used to calculate the two values and set the radius. I used a constructor to assign radius as 1, but I also have to compute the diameter/area for a larger circle. When running the code, it says that it "cannot find symbol" with the diameter in the System print line. This is the code I have so far:
class My_Circle extends Main{
float radius = 1;
public float getRadius() {
return radius;
}
public void setRadius(float newRadius) {
this.radius = newRadius;
float diameter = radius*2;
float area = radius*radius*3.14159265359f;
}
}
public class Main {
public static void main(String args[]) {
My_Circle large = new My_Circle();
My_Circle original = new My_Circle();
large.setRadius(100);
original.setRadius(original.getRadius());
System.out.println("Large Circle Diameter: " + diameter);
}
}