/// <summary> /// Spausdina butus į konsolę /// </summary> /// <param name="flats"></param> private static void PrintToConsole(FlatContainer flats) { for (int i = 0; i < flats.Count; i++) { Console.WriteLine(flats.GetFlat(i)); } }
/// <summary> /// Suranda pageidaujamus butus /// </summary> /// <param name="flats"></param> /// <param name="roomAmount"></param> /// <param name="maxprice"></param> /// <param name="minfloor"></param> /// <param name="maxfloor"></param> /// <returns></returns> private static FlatContainer FilteredFlats(FlatContainer flats, int roomAmount, double maxprice, int minfloor, int maxfloor) { FlatContainer filteredFlats = new FlatContainer(MaxFlatAmount); for (int i = 0; i < flats.Count; i++) { if (flats.GetFlat(i).Rooms == roomAmount) { if (flats.GetFlat(i).Price <= maxprice) { Console.WriteLine(flats.GetFlat(i).Floor); if (flats.GetFlat(i).Floor >= minfloor && flats.GetFlat(i).Floor <= maxfloor) { filteredFlats.AddFlat(flats.GetFlat(i)); } } } } return(filteredFlats); }