Assignment-OOP(2)
Assignment-OOP(2)
// Circle class
class Circle {
// Constructors
public Circle() {
this.radius = 1.0;
this.color = "red";
this.radius = radius;
this.color = "red";
this.radius = radius;
this.color = color;
return radius;
}
this.radius = radius;
return color;
this.color = color;
// Other Methods
// Cylinder class
public Cylinder() {
super();
this.height = 1.0;
super(radius);
this.height = 1.0;
super(radius);
this.height = height;
super(radius, color);
this.height = height;
return height;
}
public void setHeight(double height) {
this.height = height;
// Other Methods
// Main class
System.out.println("Circle:");
System.out.println();
System.out.println("Cylinder:");
// Circle class
class Circle {
// Constructors
public Circle() {
this.radius = 1.0;
this.color = "red";
this.radius = radius;
this.color = "red";
}
this.radius = radius;
this.color = color;
return radius;
this.radius = radius;
return color;
this.color = color;
// Other Methods
// Cylinder class
// Constructors
public Cylinder() {
super();
this.height = 1.0;
super(radius);
this.height = 1.0;
super(radius);
this.height = height;
}
public Cylinder(double radius, double height, String color) {
super(radius, color);
this.height = height;
return height;
this.height = height;
// Other Methods
// Main class
System.out.println("Circle:");
System.out.println();
System.out.println("Cylinder:");
// Circle class
class Circle {
// Constructors
public Circle() {
this.radius = 1.0;
this.color = "red";
this.radius = radius;
this.color = "red";
this.radius = radius;
this.color = color;
return radius;
this.radius = radius;
return color;
this.color = color;
// Other Methods
// Cylinder class
// Constructors
public Cylinder() {
super();
this.height = 1.0;
super(radius);
this.height = 1.0;
super(radius);
this.height = height;
}
public Cylinder(double radius, double height, String color) {
super(radius, color);
this.height = height;
return height;
this.height = height;
@Override
@Override
}
// Main class
System.out.println("Circle:");
System.out.println();
System.out.println("Cylinder:");