Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Rectangle
- {
- private double _height;
- private double _width;
- public Rectangle()
- {
- }
- public Rectangle(double height, double width)
- {
- _height = height;
- _width = width;
- }
- public double calculateSquare()
- {
- return _height * _width;
- }
- public double calculatePerimeter()
- {
- return 2.0 * (_height + _width);
- }
- public bool areTheSame(Rectangle r1, Rectangle r2)
- {
- if ((r1._height == r2._height && r1._width == r2._width) || (r1._height == r2._width && r1._width == r2._height))
- {
- return true;
- }
- return false;
- }
- public bool isSquare()
- {
- return _height == _width;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement