I am having trouble seeing the error of my work: I am creating an iterator (in my class LamborghiniCarLot) which will give the number of vehicles in my (ArrayList inventory;) which are rear-wheel-drive. the Lamborghini class has a method called getIsRearWheelDrive(). But attempting to call it, I get the method not found. "inventory" is the field variable holding the arraylist. Here is my code as it stands:
public int howManyAreRearWheelDrive()
{
int numberRearWheel = 0;
Iterator<Lamborghini> it = inventory.iterator();
Lamborghini inv = null;
while(it.hasNext())
{
inv = it.next();
if(inv != null)
{
if(it.getIsRearWheelDrive() == true)
{
numberRearWheel ++;
}
}
}
return numberRearWheel;
}