Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Circle implements GeometricObject{
  2. protected double radius = 1.0;
  3.  
  4. public Circle(double radius){
  5. this.radius = radius;
  6. }
  7. public double getPerimeter(){
  8. return Math.PI * 2 * this.radius;
  9. }
  10. public double getArea(){
  11. return Math.PI * (this.radius * this.radius);
  12. }
  13. }
  14. class ResizableCircle extends Circle implements Resizable{
  15.  
  16. public ResizableCircle(double rad){
  17. radius = rad;
  18. }
  19. public void resize(int percent){
  20. double per = (double) percent;
  21. double temp = this.radius * (per/100);
  22. this.radius = temp;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement