Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Circle implements GeometricObject{
- protected double radius = 1.0;
- public Circle(double radius){
- this.radius = radius;
- }
- public double getPerimeter(){
- return Math.PI * 2 * this.radius;
- }
- public double getArea(){
- return Math.PI * (this.radius * this.radius);
- }
- }
- class ResizableCircle extends Circle implements Resizable{
- public ResizableCircle(double rad){
- radius = rad;
- }
- public void resize(int percent){
- double per = (double) percent;
- double temp = this.radius * (per/100);
- this.radius = temp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement