Advertisement
mmayoub

Ex01P026-Polygon.cs

Nov 18th, 2021
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace ConsoleApp7
  6. {
  7.     // Ex01 - P026
  8.     class Polygon
  9.     {
  10.         private int n;
  11.         private Line[] lines;
  12.  
  13.         Polygon(Line[] lines_array)
  14.         {
  15.             // add your code here
  16.         }
  17.  
  18.         public double getPerimeter()
  19.         {
  20.             double sum = 0;
  21.             for (int i = 0; i < n; i++)
  22.             {
  23.                 sum = sum + lines[i].getLength();
  24.             }
  25.  
  26.             return sum;
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement