a. Inicialmente el programa debe presentar un menú con los siguientes campos:
◦ 1.- Altas
◦ 2.- Bajas
◦ 3.- Cambios
◦ 4.- Consultas
◦ 5.- Salir
b. Las “Altas” incluyen la solicitud de información básica para una persona:
◦ Nombre Completo
◦ Edad
◦ Altura
◦ Genero
c. Las “Bajas” permiten la eliminación completa de alguno de los registros
existentes en el sistema. Para ello el sistema pregunta que registro se quiere
eliminar, si el registro no existe se debe mostrar un mensaje de error.
d. Los “Cambios” como su nombre lo indica permite hacer ajustes sobre algunos
de los registros. Cuando se selecciona la opción “cambios” el sistema pregunta
que registro se quiere modifcar (numérico), para posteriormente preguntar
que campo en partcular se quiere ajustar (Nombre, Edad, etc.).
e. La opción “Consultas” presenta el siguiente submenú
◦ Por Nombre (presenta en forma completa todos lo registros que coincidan)
◦ Por Registro (presenta solo el registro solicitado)
◦ Total (presenta todos los registros)
f. La opción “Salir” cierra el programa.
Segun yo, solo me falta el inciso C y D, mi codigo que llevo es el siguiente:
Código
nombre[n] = sc.nextLine(); edad[n] = sc.nextInt(); altura[n] = sc.nextFloat(); sexo[n] = sc.next().charAt(0); } int r = sc.nextInt(); r--; for (int i = r; i < n; i++) { nombre[i] = nombre[i + 1]; edad[i] = edad[i + 1]; altura[i] = altura[i + 1]; sexo[i] = sexo[i + 1]; } System.out.println("Registro " + (n + 1) + ":\n" + "Nombre: " + nombre[n] + " " + "\n" + "Edad: " + edad[n] + " años \n" + "Altura: " + altura[n] + " m \n" + "Sexo: " + sexo[n] + "\n" + "=================="); } for (int i = 0; i < n; i++) { System.out.println("Registro " + (i + 1) + ":\n" + "Nombre: " + nombre[i] + " " + "\n" + "Edad: " + edad[i] + " años \n" + "Altura: " + altura[i] + " m \n" + "Sexo: " + sexo[i] + "\n" + "=================="); } } int r = sc.nextInt(); r--; System.out.println("Registro " + (r + 1) + ":\n" + "Nombre: " + nombre[r] + " " + "\n" + "Edad: " + edad[r] + " años \n" + "Altura: " + altura[r] + " m \n" + "Sexo: " + sexo[r] + "\n" + "=================="); } for (int j = 0; j < n; j++) { if (nom.equals(nombre[j])) { + edad[j] + " años \n" + "Altura: " + altura[j] + " m \n" + "Sexo: " + sexo[j] + "\n" + "=================="); } } } for (int j = 0; j < n; j++) { if (nombre[j] != null) { + edad[j] + " años \n" + "Altura: " + altura[j] + " m \n" + "Sexo: " + sexo[j] + "\n" + "=================="); } } } int r = 0; nombre[n] = sc.nextLine(); edad[n] = sc.nextInt(); altura[n] = sc.nextFloat(); sexo[n] = sc.next().charAt(0); nombre[r] = nombre[n]; edad[r] = edad[n]; altura[r] = altura[n]; altura[r] = altura[n]; } nombre[n] = sc.nextLine(); int r = 0; nombre[r] = nombre[n]; } edad[n] = sc.nextInt(); int r = 0; edad[r] = edad[n]; } altura[n] = sc.nextFloat(); int r = 0; altura[r] = altura[n]; } sexo[n] = sc.next().charAt(0); int r = 0; sexo[r] = sexo[n]; } int N = 30; // Es el numero de registros maximo int[] edad = new int[N]; float[] altura = new float[N]; char[] sexo = new char[N]; int opcion = 0; int Nregistro = 0; // el numero de registros ingresados while (opcion != 5) { opcion = sc.nextInt(); switch (opcion) { case 1:// altas altas(Nregistro, edad, altura, sexo, nombre); Nregistro++; muestra(Nregistro, edad, altura, sexo, nombre); break; case 2: // bajas bajas(Nregistro, edad, altura, sexo, nombre); muestra(Nregistro, edad, altura, sexo, nombre); break; case 3: // cambios int r = sc.nextInt(); r--; opcion = sc.nextInt(); switch (opcion) { // consulta case 1: cambiosnombre(Nregistro, edad, altura, sexo, nombre); muestra(Nregistro, edad, altura, sexo, nombre); break; case 2: cambiosedad(Nregistro, edad, altura, sexo, nombre); muestra(Nregistro, edad, altura, sexo, nombre); break; case 3: cambiosaltura(Nregistro, edad, altura, sexo, nombre); muestra(Nregistro, edad, altura, sexo, nombre); break; case 4: cambiosexo(Nregistro, edad, altura, sexo, nombre); muestra(Nregistro, edad, altura, sexo, nombre); break; default: break; } break; case 4: opcion = sc.nextInt(); switch (opcion) { // consulta case 1: consultarN(Nregistro, edad, altura, sexo, nombre); break; case 2: consultaR(Nregistro, edad, altura, sexo, nombre); break; case 3: consultarG(Nregistro, edad, altura, sexo, nombre); break; default: break; } case 5: break; default: break; } } } }