I am trying to write a method that accepts the array of houses and a price, priceLimit. The method will return an array
of houses for the houses whose price is less than or equal to priceLimit. I want to make a pass
over the data to determine how big to make the return array. The problem is that I can not figure out how to add House objects from one House array to the other.
private static House[] getLowPriced(House[] houses, double priceLimit)
{
House[] lowPriceHouses = null;
for (int i = 0; i <= houses.length; i++)
{
double prices = houses[i].getPrice();
if (prices <= priceLimit)
lowPriceHouses[i] = houses[i];
}
return lowPriceHouses;
}