-3
Someone could inform me a way to do the following thing: After the password or user error, or both, the user returned to the first question, in case: "Which user?" so I could try again.
package SistemaLogineRegistro;
import java.util.Scanner;
public class Login {
public static void main(String[] args) {
Usuario um = new Usuario();
um.setUsuario("Yuri", "123123yuri");
um.getUsuario();
um.getSenha();
int tentativa = 0;
Scanner s = new Scanner(System.in);
System.out.println("Qual o usuario?");
String usuario = s.nextLine();
System.out.println("Qual a senha?");
String senha = s.nextLine();
if (usuario.equalsIgnoreCase(um.getUsuario()) && senha.equals(um.getSenha())) {
System.out.println("Logado com sucesso!");
}
else if(!usuario.equals(um.usuario)) {
System.err.println("Usuario incorreto");
tentativa += 1;
} else if (!senha.equals(um.senha)) {
tentativa += 1;
System.err.println("Senha incorreta");
} else if (!senha.equals(um.senha) && !usuario.equals(um.usuario)) {
tentativa += 1;
System.out.println("Usuario e senha Incorretos !");
}else if(tentativa >= 5){
System.err.println("Você excedeu o Limite de ERRO ! (5) Tentativas");
}
{
}
}
}
You’ve studied repetitive bonding?
– Woss
I’ve studied repetition ties, But I believe I can do with the while but I don’t know how to do, I’ll try here again
– Yuri Sanford