mjc65

Statiuc

May 5th, 2020
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Rectangle
  2. {
  3.     public static string ShapeName
  4.     {
  5.         get { return "Rectangle"; }
  6.  
  7.         private double length;
  8.         private double width;
  9.  
  10.         public double Length
  11.         {
  12.             get
  13.             {
  14.                 return length;
  15.             }
  16.             set
  17.             {
  18.                 if ( value > 0.0)
  19.                     length = value;
  20.             }
  21.         }
  22.  
  23.         public double Width
  24.         {
  25.             get
  26.             {
  27.                 return width;
  28.             }
  29.             set
  30.             {
  31.                 if (value > 0.0 )
  32.                     width = value;
  33.             }
  34.         }
  35.    
  36.         public double GetArea()
  37.         {
  38.             return length * width;
  39.         }  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment