daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest Apr 25th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Circle extends EquidistantShape {
  2.    public Circle() {
  3.       setRadius(1.0);
  4.    } // end default constructor
  5.  
  6.    public Circle(double initialRadius) {
  7.       setRadius(initialRadius);
  8.    } // end constructor
  9.  
  10.    // Implementation of abstract method
  11.    public void displayStatistics() {
  12.       System.out.println("\nRadius = " + radius()
  13.          + "\nDiameter = " + diameter()
  14.          + "\nCircumference = " + circumference()
  15.          + "\nArea = " + area());
  16.    } // end displayStatistics
  17.  
  18.    public double diameter() {
  19.       return 2 * radius();
  20.    }
  21.  
  22.    public double circumference() {
  23.       return 2 * Math.PI * radius();
  24.    }
  25.  
  26.    public double area() {
  27.       return Math.PI * radius() * radius();
  28.    }
  29.  
  30. } // end Circle
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top