Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. // File name: Circle.java
  2. // Author: Zachary Conlyn
  3. // Date: 2017-01-19
  4. // Purpose: CMIS242 week 2 discussion.
  5.  
  6.  
  7. import java.awt.Color;
  8.  
  9. class Circle extends GeometricObject {
  10. private double radius;
  11.  
  12. Circle() {
  13. this.radius = 1;
  14. }
  15.  
  16. Circle(double aRadius) {
  17. this.radius = aRadius;
  18. }
  19.  
  20. Circle(Color aColor, boolean aBoolean) {
  21. super(aColor, aBoolean);
  22. this.radius = 1;
  23. }
  24.  
  25. Circle(Color aColor, boolean aBoolean, double aRadius) {
  26. super(aColor, aBoolean);
  27. this.radius = aRadius;
  28. }
  29.  
  30. public void setRadius(double r) {
  31. this.radius = r;
  32. }
  33.  
  34. public double getRadius() {
  35. return this.radius;
  36. }
  37.  
  38. public double getArea() {
  39. return Math.PI * this.radius * this.radius;
  40. }
  41.  
  42. public double getPerimeter() {
  43. return 2 * Math.PI * this.radius;
  44. }
  45.  
  46. public double getDiameter() {
  47. return 2 * this.radius;
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement