0
This method searches, by the Customer’s phone, the Reservations that are made in it.
The Customer may have more than one reservation, but the method is only showing the first reservation registered to the customer. What should I change in the code to show them all?
public void pesquisaImovelPorCliente(String telefoneCliente)
{
boolean localizouImovel = false;//variável auxiliar para verificar se a busca teve sucesso
for(int i = 0; i< qtdeReservas; i++)
{
if(ListaDeReservas[i].cliente.getTelefone().equals(telefoneCliente)){
ListaDeReservas[i].exibeDados();
//busca teve sucesso-
localizouImovel = true;
break;
}
}
if(!localizouImovel)//se não localizou
System.out.println ("Não foi localizado nenhuma acomodação para este telefone.");
}
After seeing the correct answer, if you can change the question title. This will help users who may have the same problem as you in the future.
– Paz