[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Codigueando • Ver Tema - búsqueda sensitiva por apellido
Índice general Preguntas y respuestas. - Resuelve tus Dudas. Java búsqueda sensitiva por apellido

búsqueda sensitiva por apellido

Postea aquí tus dudas con problemas o ejercicios en lenguaje Java

Reglas del Foro




Nota Dom Jun 25, 2017 11:17 pm
andy_vera Aprendiz de programador

Mensajes: 1
como hago para que la cuarta opción me salga poniendo la letra inicial de el apellido del usuario me muestre su nombre,apellido, contraseña y usuario aquí dejo el código
import java.util.Scanner;


public class Registropersonas {

public static String nombres[] = new String[20];
public static String apellidos[] = new String[20];
public static String usuarios[] = new String[20];
public static String claves[] = new String[20];
public static int registrados=0;

public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);

int opcion=0;

while(opcion!=5)
{
limpiarpantalla();
System.out.println(" SISTEMA DE REGISTRO DE USUARIOS ");
System.out.println("=================================");
System.out.println(" (1) Registrar usuario ");
System.out.println(" (2) Listado alfabético ");
System.out.println(" (3) Buscar ");
System.out.println(" (4) Busqueda sencitiva por apellido "); //esta es la cuarta opcion,de buscar al usuario por la letra inicial del apellido
System.out.println(" (5) Salir ");
System.out.println("---------------------------------");
System.out.print(" Escribir opción:");
opcion= teclado.nextInt();
switch (opcion){
case 1: RegistrarUsuario(); break;
case 2: ListarUsuarios(); break;
case 3: BuscarPersona(); break;
case 4: BusquedaSensitiva(); break;
}

}




}

public static void limpiarpantalla(){
for(int i=0; i<200;i++)
System.out.println(" ");
}

public static void RegistrarUsuario(){
limpiarpantalla();
Scanner teclado = new Scanner(System.in);
String nombre, apellido, usuario, clave;
System.out.println(" REGISTRAR USUARIO ");
System.out.println("=================================");
System.out.print(" Nombres: ");
nombre=teclado.nextLine();
System.out.print(" Apellidos: ");
apellido=teclado.nextLine();
System.out.print(" Usuario: ");
usuario=teclado.nextLine();
System.out.print(" Clave: ");
clave=teclado.nextLine();
System.out.print(" (1) Guardar (2) Cancelar : ");
if(teclado.nextInt() == 1)
{
nombres[registrados] = nombre;
apellidos[registrados] = apellido;
usuarios[registrados] = usuario;
claves[registrados] = clave;
registrados++;
}


}
public static void ListarUsuarios(){
limpiarpantalla();
Scanner teclado = new Scanner(System.in);
System.out.println(" USUARIOS REGISTRADOS ");
System.out.println("=====================================================");
System.out.print("Nro \tNOMBRE \tAPELLIDO \tUSUARIO \tCLAVE\n");
System.out.println("-----------------------------------------------------");
for(int i=0;i<registrados;i++)
System.out.print( (i+1) + "\t" + nombres[i] + "\t" + apellidos[i] + "\t\t" + usuarios[i] + "\t\t" + claves[i] + "\n");
System.out.println("=====================================================");
teclado.nextLine();

}

public static void BuscarPersona(){
limpiarpantalla();
Scanner teclado = new Scanner(System.in);
String buscar;
System.out.println(" BUSCAR USUARIO ");
System.out.println("==============================================");
System.out.print("APELLIDO: ");
buscar=teclado.nextLine();
System.out.println("==============================================");
System.out.println("RESUTALDOS DE BÚSQUEDA");

for(int i=0; i<registrados; i++)
{
if(apellidos[i].equals(buscar))
{
System.out.println("Nombre:\t" + nombres[i]);
System.out.println("Apellido:\t " + apellidos[i]);
System.out.println("Usuario:\t " + usuarios[i]);
System.out.println("Clave:\t *******" );
}
}
teclado.nextLine();
}
}

Volver a Java

cron