Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class sphere extends Shape {
- private double r;
- public sphere(String color, double a, double c, double r) {
- super (color);
- volume();
- surfaceArea();
- this.r = r;
- }
- public void volume () {
- volume = (4/3) * super.pi * Math.pow(r, 3);
- }
- public void surfaceArea() {
- surfaceArea = 4 * super.pi * Math.pow(r, 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement