Advertisement
Guest User

Vot Tebe Ring

a guest
Mar 26th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task02_6
  4. {
  5.     internal class Ring
  6.     {
  7.         private double innerrad;
  8.  
  9.         private double outerrad;
  10.  
  11.         public Ring(double ir, double or)
  12.         {
  13.             this.InnerRad = ir;
  14.             this.OutterRad = or;
  15.         }
  16.  
  17.         public double InnerRad
  18.         {
  19.             get
  20.             {
  21.                 return this.innerrad;
  22.             }
  23.  
  24.             set
  25.             {
  26.                 if (value < this.outerrad)
  27.                 {
  28.                     this.innerrad = value;
  29.                 }
  30.             }
  31.         }
  32.  
  33.         public double OutterRad
  34.         {
  35.             get
  36.             {
  37.                 return this.outerrad;
  38.             }
  39.  
  40.             set
  41.             {
  42.                 if (value > this.innerrad)
  43.                 {
  44.                     this.outerrad = value;
  45.                 }
  46.             }
  47.         }
  48.  
  49.         public double TotalCircumference()
  50.         {
  51.             return (2 * this.innerrad * Math.PI) + (2 * this.outerrad * Math.PI);
  52.         }
  53.  
  54.         public double Area()
  55.         {
  56.             return (Math.PI * Math.Pow(this.outerrad, 2)) - (Math.PI * Math.Pow(this.innerrad, 2));
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement