i need help, i have several cases and i want to return from a case to another case, but it keeps returning to the do menu, example i click 1 then 1 and then 1 and the program returns to the first case, the login case but i want to return to the visualize one
public static void main(String[] args) {
int op;
Scanner ler = new Scanner(System.in);
do
{
System.out.println("1 - Iniciar sessão");//login
System.out.println("0 - Terminar programa");//end program
System.out.print("OP-> ");
op = ler.nextInt();
switch(op)
{
case 1:
System.out.println("1 - Visualizar lista encomendas realizadas");//visualize
System.out.println("2 - Listar/adicionar/modificar/eliminar produtos");//modifie/remove/add product
System.out.println("3 - Listar/adicionar/modificar/eliminar clientes");//modifie/remove/add client
System.out.println("4 - Listar/adicionar/modificar/eliminar transporte");//modifie/remove/add transportation
System.out.println("5 - Terminar sessão");//end session
System.out.println("0 - Terminar programa");//end program
System.out.println("OP-> ");
op = ler.nextInt();
switch(op)
{
case 1:
System.out.println("1 - Voltar ao menu principal");//return to menu
System.out.println("OP-> ");
op = ler.nextInt();
break;
case 2:
System.out.println("1 - Listar produtos");
System.out.println("2 - Adicionar produtos");
System.out.println("3 - Modificar produtos");
System.out.println("4 - Eliminar produtos");
System.out.println("5 - Voltar");
System.out.println("OP-> ");
op = ler.nextInt();
switch (op)
{
case 1:
break;
case 2:
break;
default: System.out.println("Opção inválida");
}
break;
case 3:
System.out.println("1 - Listar clientes");
System.out.println("2 - Adicionar clientes");
System.out.println("3 - Modificar clientes");
System.out.println("4 - Eliminar clientes");
System.out.println("5 - Voltar");
System.out.println("OP-> ");
op = ler.nextInt();
switch (op)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
default: System.out.println("Opção inválida");
}
break;
case 4:
System.out.println("1 - Listar transporte");
System.out.println("2 - Adicionar transporte");
System.out.println("3 - Modificar transporte");
System.out.println("4 - Eliminar transporte");
System.out.println("5 - Voltar");
System.out.println("OP-> ");
op = ler.nextInt();
switch (op)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
default: System.out.println("Opção inválida");
}
break;
case 5:
break;
default: System.out.println("Opção inválida");
}
break;
default: System.out.println("Opção inválida");
}
}
while(op!=0);
}
}