Bom dia amigos estou começando a aprender java faz 1 mês mais ou menos e tenho um programa que meu professor pediu pra fazer ele é mais ou menos assim: Cadastrar professor e excluir professor o metodo para cadastar eu fiz mas o de excluir não estou conseguindo alguém pederia me ajudar.
Meu código da Classe Professor
[code]import javax.swing.JOptionPane;
public class Professor {
private int CodProf;
private String NomeProf;
public void InserirProfessor (int codiProf , String nmProf)
{
CodProf = codiProf;
NomeProf = nmProf;
}
public void ExcluirProfessor()
{
}
}[/code]
e Classe que inicia é essa:
[code]import javax.swing.JOptionPane;
public class IniciarProfessor {
public static void main (String args[])
{
int codPrf;
String cont = null;
String nmProf = null;
Professor progProf = new Professor();
while (cont != "100")
{
String Opcs = JOptionPane.showInputDialog(null,"Escolha o que você deseja fazer:\n \n 1- Cadastrar Professor \n" +
" 2- Excluir Professor \n ","Opções",JOptionPane.YES_NO_CANCEL_OPTION);
int a = Integer.parseInt(Opcs);
if (a == 1)
{
String NomeProf = JOptionPane.showInputDialog(null,"Digite o " +
"Nome:","Cadastro",JOptionPane.QUESTION_MESSAGE);
nmProf = NomeProf;
String CodProf = JOptionPane.showInputDialog(null,"Digite o " +
"Código:","Cadastro",JOptionPane.QUESTION_MESSAGE);
int code = Integer.parseInt(CodProf);
codPrf = code;
JOptionPane.showMessageDialog(null,"O Cadastro foi concluido com sucesso!");
}
else if (a == 2)
{
}
// Tela que pede se deseja continuar ou não
String Sair = JOptionPane.showInputDialog(null,"Deseja Continuar:\n[1] SIM\n[2] NÂO \n","Deseja Continuar",JOptionPane.PLAIN_MESSAGE);
double saida = Integer.parseInt(Sair);
if (saida == 2) // Se for igual a 2 o programa finaliza
{
cont = "100";
}
}
}
}[/code]
Espero que alguém tenha entendido o que eu quero.