Advertisement
droidus

Sphere

Oct 24th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. public class sphere extends Shape {
  2.    
  3.     private double r;
  4.    
  5.     public sphere(String color, double a, double c, double r) {
  6.         super (color);
  7.         volume();
  8.         surfaceArea();
  9.         this.r = r;
  10.     }
  11.    
  12.     public void volume () {
  13.         volume = (4/3) * super.pi * Math.pow(r, 3);
  14.     }
  15.    
  16.     public void surfaceArea() {
  17.         surfaceArea = 4 * super.pi * Math.pow(r, 2);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement