Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File name: Circle.java
- // Author: Zachary Conlyn
- // Date: 2017-01-19
- // Purpose: CMIS242 week 2 discussion.
- import java.awt.Color;
- class Circle extends GeometricObject {
- private double radius;
- Circle() {
- this.radius = 1;
- }
- Circle(double aRadius) {
- this.radius = aRadius;
- }
- Circle(Color aColor, boolean aBoolean) {
- super(aColor, aBoolean);
- this.radius = 1;
- }
- Circle(Color aColor, boolean aBoolean, double aRadius) {
- super(aColor, aBoolean);
- this.radius = aRadius;
- }
- public void setRadius(double r) {
- this.radius = r;
- }
- public double getRadius() {
- return this.radius;
- }
- public double getArea() {
- return Math.PI * this.radius * this.radius;
- }
- public double getPerimeter() {
- return 2 * Math.PI * this.radius;
- }
- public double getDiameter() {
- return 2 * this.radius;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement