Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1.  
  2.         static void Main(string[] args)
  3.         {
  4.             List<Circle> circleList = new List<Circle>();
  5.             circleList.Add(new Circle(1,2,3));
  6.             circleList.Add(new Circle(344, 2, 5));
  7.             circleList.Add(new Circle(4, 2, 2));
  8.  
  9.  
  10.             Circle CircleWithMaxArea= circleList.OrderByDescending(x => x.Area()).FirstOrDefault();
  11. }
  12.  
  13.  
  14.  class Circle
  15.     {
  16.  
  17.         public double X { get; set; }
  18.         public double Y { get; set; }
  19.  
  20.         public double Radius { get; set; }
  21.  
  22.         public Circle(double x, double y, double radius)
  23.         {
  24.             this.X = x;
  25.             this.Y = y;
  26.             this.Radius = radius;
  27.         }
  28.  
  29.         public double Area()
  30.         {
  31.             return Math.PI * this.Radius * this.Radius;            
  32.         }
  33.  
  34.         public Circle Clone()
  35.         {
  36.             return new Circle(this.X, this.Y, this.Radius);
  37.         }
  38.  
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement