Advertisement
Guest User

Untitled

a guest
Nov 14th, 2021
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Shapes
  6. {
  7. public class Rectangle : Shape
  8. {
  9. public Rectangle(double height, double width)
  10. {
  11. Height = height;
  12. Width = width;
  13. }
  14.  
  15. public double Height { get; protected set; }
  16. public double Width { get; protected set; }
  17. public override double CalculateArea()
  18. {
  19. return Height * Width;
  20. }
  21.  
  22. public override double CalculatePerimeter()
  23. {
  24. return 2 * Height + 2 * Width;
  25. }
  26.  
  27. public override string Draw()
  28. {
  29. return base.Draw() + this.GetType().Name;
  30. }
  31. }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement