// Első feladat using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; // Szabó Márton 12/b // A csoport namespace ConsoleApp1 { class Diak { private string nev; private int eletkor; public string Nev { get { return this.nev; } set { this.nev = value;} } public int Eletkor { get { return this.eletkor; } set { this.eletkor = value;} } public Diak(string diaknev, int diakkor) { Nev = diaknev; Eletkor = diakkor; } } class Osztaly { public string osztalynev; public List tanulok = new List(); public Osztaly(){} public void Diakhozzaad(Diak tanulo) { this.tanulok.Add(tanulo); } public void Diakadatok() { Console.WriteLine(this.osztalynev); Console.WriteLine(); foreach (Diak tanulo in tanulok) { Console.WriteLine($"{tanulo.Nev}, kor:{tanulo.Eletkor}"); } } } class Program { static void Main(string[] args) { Osztaly osztaly = new Osztaly { osztalynev = "12/B"}; Diak diak1 = new Diak("Szabó Márton", 18); Diak diak2 = new Diak("Medve Gergő", 18); osztaly.Diakhozzaad(diak1); osztaly.Diakhozzaad(diak2); osztaly.Diakadatok(); } } } // Második feladat using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; // Szabó Márton 12/b // A csoport namespace ConsoleApp2 { public class Haromszog { public double Ax, Ay, Bx, By, Cx, Cy; public double aoldal, boldal, coldal; public Haromszog(double ax , double ay, double bx, double by, double cx, double cy) { Ax = ax; Ay = ay; Bx = bx; By = by; Cx = cx; Cy = cy; aoldal = System.Math.Sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy)); boldal = System.Math.Sqrt((ax - cx) * (ax - cx) + (ay - cy) * (ay - cy)); coldal = System.Math.Sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay)); } public void Szabalyossag() { if (aoldal == boldal && boldal == coldal) { Console.WriteLine("Ez egy szabályos háromszög."); } else if (aoldal == boldal || aoldal == coldal || boldal == coldal){ Console.WriteLine("Ez egy egyenlő szárú háromszög."); } else { Console.WriteLine("Ez a háromszög nem egyenlő szárú és nem is szabályos."); } } public double Kerület() { return aoldal + boldal + coldal; } public double Terület() { return 0.5 * System.Math.Abs(Ax * (By - Cy) + Bx * (Cy - Ay) + Cx * (Ay - By)); } } class Haromszogellenorzo { public double a, b, c, d, e, f; public void Ell() { Haromszog harom = new Haromszog(a, b, c, d, e, f); harom.Szabalyossag(); Console.WriteLine(harom.Kerület()); Console.WriteLine(harom.Terület()); Console.WriteLine(harom.aoldal); Console.WriteLine(harom.boldal); Console.WriteLine(harom.coldal); } public Haromszogellenorzo() { Console.WriteLine("Adjon meg az A csúcs x koordinátáját!"); a = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Adjon meg az A csúcs y koordinátáját!"); b = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Adjon meg az B csúcs x koordinátáját!"); c = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Adjon meg az B csúcs y koordinátáját!"); d = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Adjon meg az C csúcs x koordinátáját!"); e = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Adjon meg az C csúcs y koordinátáját!"); f = Convert.ToDouble(Console.ReadLine()); } } class Program { static void Main(string[] args) { Haromszogellenorzo ell = new Haromszogellenorzo(); ell.Ell(); } } }