-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCapturaDatos.java
More file actions
28 lines (25 loc) · 979 Bytes
/
CapturaDatos.java
File metadata and controls
28 lines (25 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class CapturaDatos
{
public static String capturaInfo(String msg)
{
Scanner sc = new Scanner(System.in);
System.out.print("" + msg + ": " );
return sc.nextLine();
}
public static String capturaFechaNacimiento(String msg)
{
Scanner sc = new Scanner(System.in);
/* Variables tipo String para capturar fecha */
String day = new String();
String month = new String();
String year = new String();
/* Captura de la fecha */
System.out.println(msg + "Ej. dd/mm/aaaa");
System.out.print("Dia: "); day = sc.nextLine();
System.out.print("Mes: "); month = sc.nextLine();
System.out.print("Anio: "); year = sc.nextLine();
/* Regresa cadena con el formato dd/mm/aaaa */
return String.join("/", day, month, year);
}// Fin del metodo de capturar fecha
}// Fin de la clase CapturaDatos