Guest User

Untitled

a guest
Jun 25th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package com.yahoo.hlctt;
  2.  
  3. public class Circle extends Shape {
  4. private Point pCenter;
  5. private Point pRadius;
  6.  
  7. private String type = "Circle";
  8.  
  9. public Circle(Point pCenter, Point pRadius) {
  10. super();
  11. this.pCenter = pCenter;
  12. this.pRadius = pRadius;
  13. }
  14.  
  15. public Circle() {
  16. super();
  17. }
  18.  
  19. public Point getpCenter() {
  20. return pCenter;
  21. }
  22.  
  23. public void setpCenter(Point pCenter) {
  24. this.pCenter = pCenter;
  25. }
  26.  
  27. public Point getpRadius() {
  28. return pRadius;
  29. }
  30.  
  31. public void setpRadius(Point pRadius) {
  32. this.pRadius = pRadius;
  33. }
  34.  
  35. public String getType() {
  36. return type;
  37. }
  38.  
  39. public double getLine(Point p1, Point p2) {
  40. return Math.sqrt(Math.pow((p2.getX() - p1.getX()), 2) + Math.pow((p2.getY() - p1.getY()), 2));
  41. }
  42.  
  43. @Override
  44. double getPerimetr() {
  45. return getLine(pCenter, pRadius) * 2 * Math.PI;
  46. }
  47.  
  48. @Override
  49. double getArea() {
  50. return Math.PI * Math.pow(getLine(pCenter, pRadius), 2);
  51. }
  52.  
  53. }
Add Comment
Please, Sign In to add comment