Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package at.ac.campuswien.shape;
- public class Circle extends Shape {
- private int centerX;
- private int centerY;
- private int radius;
- public Circle(int x,int y,int rad){
- this.centerX = x;
- this.centerY = y;
- this.radius = rad;
- }
- public Circle(int x,int y,int rad,String color, String name, boolean stroke){
- this.centerX = x;
- this.centerY = y;
- this.radius = rad;
- super.setColor(color);
- super.setName(name);
- super.setStroked(stroke);
- }
- public double getArea(){
- return (radius*radius)*3.1415;
- }
- public double getPerimeter(){
- return 2*3.1415*radius;
- }
- public String toString(){
- return "centerX = "+centerX+" centerY= "+centerY+" Radius= "+radius+" Area= "+ this.getArea()
- +" Perimeter= "+ this.getPerimeter();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement