maygapixel

Untitled

Apr 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. //Square.java
  2. public class Square extends Polygon {
  3. private  double length;
  4. //constructor
  5. public Square (double length )
  6. {   super(4);
  7. sides[0] = length;
  8. sides[1] = length;
  9. sides[2] = length;
  10. sides[3] = length;
  11. calArea();
  12. }
  13. public void calArea() {
  14. area = sides[0] * sides[0];
  15. }
  16. public void setlength(double length ) {
  17. this.length = length;
  18. }
  19. public double getlength() {
  20.     return this.length;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment