Files
c-sharp/Negyszog/Negyszog.cs

37 lines
841 B
C#
Raw Normal View History

2022-04-29 11:16:40 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Negyszog {
public class Negyszog {
public double oldal { get; set; }
2022-04-29 11:55:26 +02:00
public double oszlop;
2022-04-29 11:16:40 +02:00
public Negyszog(double oldal) {
this.oldal = oldal;
}
2022-04-29 11:55:26 +02:00
public void getOszlop(double oszlop) {
if(oszlop <= 0) {
throw new ArgumentException("A magasság negativ!");
} else {
this.oszlop = oszlop;
}
}
2022-04-29 11:16:40 +02:00
public double Kerulet() {
return 4.0 * oldal;
}
public double Terulet() {
return oldal*oldal;
}
public double Atlo() {
return Math.Round(Math.Sqrt(oldal*oldal * 2) * 100.0) / 100.0;
}
}
}