Advertisement
calcpage

APCS2012_C4X9_SodaCan.java

Oct 18th, 2012
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.43 KB | None | 0 0
  1. //SodaCan.java      MrG     2012.1016
  2. public class SodaCan
  3. {
  4.     private double d;
  5.     private double h;
  6.     private final double pi=3.14159;
  7.  
  8.     public SodaCan(double d, double h)
  9.     {
  10.         this.d=d;
  11.         this.h=h;
  12.     }
  13.  
  14.     public double getD()
  15.     {
  16.         return d;
  17.     }
  18.  
  19.     public double getH()
  20.     {
  21.         return h;
  22.     }
  23.  
  24.     public double getV()
  25.     {
  26.         return pi*Math.pow(d/2,2)*h;
  27.     }
  28.  
  29.     public double getS()
  30.     {
  31.         return 2*pi*Math.pow(d/2,2)+2*pi*d/2*h;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement