DHaromszog/haromszogek/DHaromszog.cs
Szabolcs Zsolt Csizmadia 55988d30eb asdadasdasdasd
2024-01-04 14:59:36 +01:00

99 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace haromszogek
{
class DHaromszog
{
private double aOldal;
private double bOldal;
private double cOldal;
public double a
{
get { return aOldal; }
set {
if(value > 0)
{
aOldal = value;
}
else
{
throw new Exception("Az a oldal nem lehet nulla vagy negatív!");
}
}
}
public double b
{
get { return bOldal; }
set
{
if (value > 0)
{
bOldal = value;
}
else
{
throw new Exception("A b oldal nem lehet nulla vagy negatív!");
}
}
}
public double c
{
get { return cOldal; }
set
{
if (value > 0)
{
cOldal = value;
}
else
{
throw new Exception("A c oldal nem lehet nulla vagy negatív!");
}
}
}
public int Sorszama { get; set; }
public bool EllNovekvoSorrend
{
get
{
return a <= b && b < c;
}
}
public bool EllMegszerkesztheto
{
get
{
return a + b > c;
}
}
public bool EllDerekszogu
{
get
{
return c * c == a * a + b * b;
}
}
public DHaromszog(string sor, int sorSzama)
{
Sorszama = sorSzama;
string[] oldalak = sor.Split(' ');
a = double.Parse(oldalak[0]);
b = double.Parse(oldalak[1]);
c = double.Parse(oldalak[2]);
}
}
}