DHaromszog/haromszogek/DHaromszog.cs

99 lines
2.1 KiB
C#
Raw Normal View History

2024-01-04 11:57:00 +00:00
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; }
2024-01-04 13:59:36 +00:00
set {
if(value > 0)
{
aOldal = value;
}
else
{
throw new Exception("Az a oldal nem lehet nulla vagy negatív!");
}
}
2024-01-04 11:57:00 +00:00
}
2024-01-04 13:59:36 +00:00
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;
}
}
2024-01-04 11:57:00 +00:00
2024-01-04 13:59:36 +00:00
public DHaromszog(string sor, int sorSzama)
2024-01-04 11:57:00 +00:00
{
2024-01-04 13:59:36 +00:00
Sorszama = sorSzama;
string[] oldalak = sor.Split(' ');
2024-01-04 11:57:00 +00:00
2024-01-04 13:59:36 +00:00
a = double.Parse(oldalak[0]);
b = double.Parse(oldalak[1]);
c = double.Parse(oldalak[2]);
2024-01-04 11:57:00 +00:00
}
}
}