Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public class Rectangle
  2. {
  3. private double _height;
  4. private double _width;
  5.  
  6. public Rectangle()
  7. {
  8.  
  9. }
  10.  
  11. public Rectangle(double height, double width)
  12. {
  13. _height = height;
  14. _width = width;
  15. }
  16.  
  17. public double calculateSquare()
  18. {
  19. return _height * _width;
  20. }
  21.  
  22. public double calculatePerimeter()
  23. {
  24. return 2.0 * (_height + _width);
  25. }
  26.  
  27. public bool areTheSame(Rectangle r1, Rectangle r2)
  28. {
  29. if ((r1._height == r2._height && r1._width == r2._width) || (r1._height == r2._width && r1._width == r2._height))
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35.  
  36. public bool isSquare()
  37. {
  38. return _height == _width;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement