rendered paste bodypublic class Agenda{public static int entrada;public static void main( String args[] ){String agenda[][];agenda=new String [20] [3];int x;int y=0;int cont=0;listaOpcao();while( entrada != 4 ){if( entrada == 1 )preencheAgenda();elseif( entrada == 2 )listaAgenda();elseif( entrada == 3)editarAgenda();elseJOptionPane.showMessageDialog( null, "Opcao Incorreta!" );listaOpcao();}}public static void preencheAgenda(){for (x=0;x<20;x++){cont=(cont+1);if (y!=-1){agenda[x][0]=JOptionPane.showInputDialog("Digite o nome:");agenda[x][1]=JOptionPane.showInputDialog("Digite o Endereco:");agenda[x][2]=JOptionPane.showInputDialog("Digite o número:");y=Integer.parseInt(JOptionPane.showInputDialog("Quer adicionar outro nome? 0=sim, -1=não"));}else{x=20;}}}public static void listaAgenda(){y=0;if (cont>1){for (x=0;x<cont;x++){System.out.println (agenda[x][0] + agenda[x][1] + agenda[x][2]);}}else{System.out.println("Agenda vazia");}}}public static void editarAgenda(){listaAgenda();x=Integer.parseInt(JOptionPane.showInputDialog("Que linha quer editar?"));agenda[x][0]=JOptionPane.showInputDialog("Digite o novo nome:");agenda[x][1]=JOptionPane.showInputDialog("Digite o novo Endereco:");agenda[x][2]=JOptionPane.showInputDialog("Digite o novo Numero:");listaAgenda();}public static void listaOpcao(){String entre = JOptionPane.showInputDialog(null, "Opções:\n1-Preencher Agenda\n2-Lista\n3-Editar\n4-Sair","Menu", JOptionPane.QUESTION_MESSAGE );entrada = Integer.parseInt( entre );}