Нужно исправить ошибки в классе "Triangle" - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Triangle
{
public double A, B, C;
public double Perimeter {
get {
return A + B + C;
}
public Triangle(double a, double b, double c) {
this.A = a;
this.B = b;
this.C = c;
}
public double Area() {
double p = Perimeter / 2.0;
return Math.Sqrt(p * (p - A) * (p - B) * (p - C));
}
private static void Main() {
Triangle tr1 = new Triangle(2.0, 3.0, 5.0);
Console.WriteLine("Triangle {0}x{1}x{2}; P = {3}; S={4}",
tr1.A, tr1.B, tr1.C,
tr1.Perimeter, tr1.Area);
Triangle tr2 = new Triangle(25.5, 44.2, 13.85);
Console.WriteLine("Triangle {0}x{1}x{2}; P = {3}; S={4}",
tr2.A, tr2.B, tr2.C,
tr2.Perimeter, tr2.Area);
}
}Решение задачи: «Нужно исправить ошибки в классе "Triangle"»
textual
Листинг программы
Console.WriteLine("Triangle {0}x{1}x{2}; P = {3}; S={4}",
tr2.A, tr2.B, tr2.C,
tr2.Perimeter, tr2.Area());