Advertisement
john2054

Wheel

Sep 21st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.  double radius;
  2.  
  3.   Wheel (double radius) {
  4.     this.radius = radius;
  5.   }
  6.  
  7.   double getCircumference () {
  8.     return 2 * Math.PI * radius;
  9.   }
  10.   double getArea () {
  11.     return radius * radius * Math.PI;
  12.   }
  13.  
  14.   public static void main (String[] args) {
  15.    
  16.     System.out.println("Please provide a real.");
  17.     Scanner s = new Scanner(System.in);
  18.     double d = s.nextDouble();
  19.    
  20.     System.out.println(d);
  21.    
  22.     Wheel w = new Wheel(d);
  23.     System.out.println(w.getCircumference());
  24.     System.out.println(w.getArea());
  25.   }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement