コード例 #1
0
 public string OutputAsHTML(IShape shape)
 {
     return($"<p>Area : {shape.CalculateArea()}</p><br /><p>Perimeter : {shape.CalculatePerimeter()}</p>");
 }
コード例 #2
0
 public string OutputAsJSON(IShape shape)
 {
     return($"{{ \"Area\" : {shape.CalculateArea()}, \"Perimeter\" : {shape.CalculatePerimeter()} }}");
 }
コード例 #3
0
ファイル: Triangle .cs プロジェクト: mpaulohs/Tu-Varna
        public int CompareTo(IShape other)
        {
            var perimeterCheck = Math.Round(this.CalculatePerimeter(), 2).CompareTo(Math.Round(other.CalculatePerimeter(), 2));

            return(perimeterCheck == 0
                ? Math.Round(this.CalculateSurface(), 2).CompareTo(Math.Round(other.CalculateSurface(), 2))
                : perimeterCheck);
        }