CarlosWGama icon

poo4-menu

CarlosWGama | PRO | 05/25/18 07:53:03 PM UTC | 0 ⭐ | 931 👁️ | Never ⏰ | []
Java |

680 B

|

None

|

0 👍

/

0 👎

public class Menu {
 
    private static Scanner reader = new Scanner(System.in);
    
    public static void editarPerfil(Aluno aluno, Professor professor) {
        
        System.out.println("Digite seu nome: ");
        String nome = reader.next();
        System.out.println("Digite sua matricula: ");
        int matricula = reader.nextInt();
        System.out.println("Digite sua nova senha:");
        String senha = reader.next();
        
        if (aluno != null) {
            aluno.setNome(nome);
            aluno.setMatricula(matricula);
            aluno.setSenha(senha);
            aluno.exibirDados();
        } else {
            professor.setNome(nome);
            professor.setMatricula(matricula);
            professor.setSenha(senha);
            professor.exibirDados();
        }
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎