This commit is contained in:
kuncsanadlajos 2024-04-11 13:56:08 +02:00
parent 9702b5f6be
commit 881be802ba
2 changed files with 34 additions and 0 deletions

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace RealEstate
{
@ -57,6 +59,12 @@ namespace RealEstate
{
List<Ad> lista = new List<Ad>();
string[] sorok = File.ReadAllLines(filename);
for (int i = 1; i < sorok.Length; i++)
{
lista.Add(new Ad(sorok[i]));
}
return lista;
}
@ -74,6 +82,14 @@ namespace RealEstate
ImageUrl = t[7];
CreateAt = DateTime.Parse(t[8]);
Seller = new Seller(int.Parse(t[9]), t[10], t[11]);
Category = new Category(int.Parse(t[12]), t[13]);
}
public double DistanceTo(double lat2, double long2)
{
double lat1 = double.Parse(LatLong.Split(',')[0].Replace('.',','));
double long1 = double.Parse(LatLong.Split(',')[1].Replace('.',','));
return Math.Sqrt();
}
}
}

View File

@ -10,7 +10,25 @@ namespace RealEstate
{
static void Main(string[] args)
{
List<Ad> hirdetesek = Ad.LoadFromCsv(@"..\..\realestates.csv");
double fszsumma = 0;
double darab = 0;
foreach (var item in hirdetesek)
{
if (item.Floors == 0)
{
fszsumma += item.Area;
darab++;
}
}
double atlag = fszsumma / darab;
Console.WriteLine($"6.feladat: A földszinti ingatlanok átlagos alapterülete: {atlag:F2} m2.");
//6.feladat - Lambda
//double atlag2 = hirdetesek.Average(h => h.Area);
double atlag2 = hirdetesek.Where(h => h.Floors == 0).Average(h => h.Area);
Console.WriteLine($"6.feladat/2: A földszinti ingatlanok átlagos alapterülete: {atlag2:F2} m2.");
}
}
}