Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.yahoo.hlctt;
- public class Circle extends Shape {
- private Point pCenter;
- private Point pRadius;
- private String type = "Circle";
- public Circle(Point pCenter, Point pRadius) {
- super();
- this.pCenter = pCenter;
- this.pRadius = pRadius;
- }
- public Circle() {
- super();
- }
- public Point getpCenter() {
- return pCenter;
- }
- public void setpCenter(Point pCenter) {
- this.pCenter = pCenter;
- }
- public Point getpRadius() {
- return pRadius;
- }
- public void setpRadius(Point pRadius) {
- this.pRadius = pRadius;
- }
- public String getType() {
- return type;
- }
- public double getLine(Point p1, Point p2) {
- return Math.sqrt(Math.pow((p2.getX() - p1.getX()), 2) + Math.pow((p2.getY() - p1.getY()), 2));
- }
- @Override
- double getPerimetr() {
- return getLine(pCenter, pRadius) * 2 * Math.PI;
- }
- @Override
- double getArea() {
- return Math.PI * Math.pow(getLine(pCenter, pRadius), 2);
- }
- }
Add Comment
Please, Sign In to add comment