Advertisement
hamaXD

LAB1 Sphere

Jan 31st, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class Sphere{
  2.     private float redius;
  3.     private float area;
  4.     private float volume;
  5.  
  6.     public void setRedius(float temp){
  7.         redius = temp;
  8.     }
  9.     public void calculateSurfaceArea(){
  10.         area = (float) (4*3.14*(Math.pow(redius,2) ));
  11.     }
  12.  
  13.     public void calculateVolume(){
  14.         volume = (float)( (4*3.14*(Math.pow(redius,3)))/3 );
  15.     }
  16.     public float getArea(){
  17.         return area;
  18.     }
  19.  
  20.     public float getVolume(){
  21.         return volume;
  22.     }
  23.    
  24.  
  25.    
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement