-1
Hello, the following method is not showing the data output correctly. At the end of the run it shows the name of the product and then the message "CPF not registered". Follows an image to facilitate understanding.
public void consultarCompra(){
System.out.println("INFORME SEU CPF: ");
String cpf = entrada.next();
for (int i = 0; i < dados.size(); i++) {
if (dados.get(i).cpf.equals(cpf)) {
System.out.println("O DONO DESTE CPF COMPROU: \n" + dados.get(i).nome);
} else {
System.out.println("CPF NÃO ENCONTRADO");
}
}
If you have one more item on that list that CPF 123 did not buy, the "CPF NOT FOUND" will appear once again. Now think...
– Natan Fernandes