0% found this document useful (0 votes)
12 views

DF

Uploaded by

whono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

DF

Uploaded by

whono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package shapee;

/**
*
* @author TALAL
*/
public class Sphere extends ThreeDimensionalShape{
private double radius;

public Sphere(double radius, String name, Color color) {


super(name, color);
if(radius<=0) {

throw new IllegalArgumentException("It should be greater than 0 ");

}
this.radius = radius;
}

public double getRadius() {


return radius;
}

public void setRadius(double radius) {


this.radius = radius;
}

public double Volume(){


return 4/3*Math.PI*radius*radius*radius;
}

@Override
public String toString() {
return super.toString();
}
}

You might also like