0
The problem calls for the creation of a program that reads the name, Cpf, email and phone of 10 people. Then provide 4 query options (1-By name, 2-By CPF, 3-By email and 4-By phone). For example, if the user chooses option 2, the query should request a CPF and, based on it, should print the customer data that has this CPF. The program should inform if it does not find any client with the informed data. Use a 10 x 4 matrix to represent the data.
The problem is that it compiles right, asks for the information, informs the menu, but when I enter for example a name to query, nothing appears. What’s the matter?
import java.util.Scanner;
public class Exercicio10 {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in); //leitura de dados da matriz
Scanner lm = new Scanner(System.in); //leitura de dados do menu
Scanner n = new Scanner(System.in); //leitura de nome
Scanner c = new Scanner(System.in); //leitura de cpf
Scanner e = new Scanner(System.in); //leitura de email
Scanner t = new Scanner(System.in); //leitura de telefone
String m[][] = new String [10][4];
int i, j;
for (i = 0; i < 10; i++) {
System.out.println("Informe o nome, CPF, e-mail e telefone da " + (i+1) + "ª pessoa:");
for (j = 0; j < 4; j++) {
m[i][j] = ler.nextLine();
}
}
System.out.println("Opções de consulta:");
System.out.println("|1| - Consultar por nome");
System.out.println("|2| - Consultar por CPF");
System.out.println("|3| - Consultar por e-mail");
System.out.println("|4| - Consultar por telefone");
int menu = lm.nextInt();
switch (menu) {
case 1:
System.out.println("Insira o nome:");
String nome = n.nextLine();
for (i = 0; i < 0; i++) {
if (nome == m[i][1]) {
System.out.println(m[i][1]);
}
}
break;
case 2:
System.out.println("Insira o CPF:");
String cpf = c.next();
for (i = 0; i < 0; i++) {
if (cpf == m[i][2]) {
System.out.println(m[i][2]);
}
}
break;
case 3:
System.out.println("Insira o e-mail:");
String email = e.next();
for (i = 0; i < 0; i++) {
if (email == m[i][3]) {
System.out.println(m[i][3]);
}
}
break;
case 4:
System.out.println("Insira o telefone:");
String telefone = t.next();
for (i = 0; i < 0; i++) {
if (telefone == m[i][4]) {
System.out.println(m[i][4]);
}
}
break;
}
}
}
thank you so much!!
– Laura