Advertisement
Guest User

Sistema java

a guest
Oct 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class sistema {
  4. public static void main(String[] args) {
  5.  
  6. Scanner scanner = new Scanner(System.in);
  7. // int adulto = 18;
  8.  
  9. //PREGUNTAS
  10. System.out.print("Nombre: ");
  11. String nombre = scanner.nextLine();
  12.  
  13. System.out.print("Primer Apellido: ");
  14. String apellido1 = scanner.nextLine();
  15.  
  16. System.out.print("Segundo Apellido: ");
  17. String apellido2 = scanner.nextLine();
  18.  
  19. System.out.print("Edad: ");
  20. int edad = Integer.parseInt(scanner.nextLine());
  21.  
  22. System.out.print("Pais: ");
  23. String pais = scanner.nextLine();
  24.  
  25. System.out.print("Ciudad: ");
  26. String ciudad = scanner.nextLine();
  27.  
  28. System.out.print("Calle: ");
  29. String calle = scanner.nextLine();
  30.  
  31. System.out.print("Numero: ");
  32. String numero = scanner.nextLine();
  33.  
  34. System.out.print("Telefono: ");
  35. String telefono = scanner.nextLine();
  36.  
  37. System.out.print("Correo: ");
  38. String correo = scanner.nextLine();
  39.  
  40. System.out.println("");
  41. System.out.println("");
  42. System.out.println("");
  43.  
  44. System.out.println("Bienvenido, " + nombre + " " + apellido1 + " " + apellido2);
  45. System.out.println("¿Que quieres hacer?");
  46. System.out.println("1. Revisar tus datos");
  47. System.out.println("2. Editar tus datos");
  48. System.out.println("3. Salir");
  49. System.out.print("---> ");
  50.  
  51. int opcion = Integer.parseInt(scanner.nextLine());
  52.  
  53. System.out.println("");
  54. System.out.println("");
  55. System.out.println("");
  56.  
  57. //OPERACION
  58.  
  59.  
  60. do {
  61.  
  62. switch (opcion) {
  63. case 1:
  64. System.out.println("Usuario: " + nombre + " " + apellido1 + " " + apellido2);
  65. System.out.println("Direccion: " + calle + ", " + numero + " (" + ciudad + ", " + pais + ")");
  66. System.out.println("Contacto: ");
  67. System.out.println(" - Telefono: " + telefono);
  68. System.out.println(" - Correo: " + correo);
  69. System.out.println("");
  70. System.out.println("");
  71. System.out.println("");
  72. break;
  73.  
  74. case 2 :
  75. System.out.print("Nombre: ");
  76. nombre = scanner.nextLine();
  77.  
  78. System.out.print("Primer apellido: ");
  79. apellido1 = scanner.nextLine();
  80.  
  81. System.out.print("Segundo apellido: ");
  82. apellido2 = scanner.nextLine();
  83.  
  84. System.out.print("Edad: ");
  85. edad = Integer.parseInt(scanner.nextLine());
  86.  
  87. System.out.print("Pais: ");
  88. pais = scanner.nextLine();
  89.  
  90. System.out.print("Ciudad: ");
  91. ciudad = scanner.nextLine();
  92.  
  93. System.out.print("Calle: ");
  94. calle = scanner.nextLine();
  95.  
  96. System.out.print("Numero: ");
  97. numero = scanner.nextLine();
  98.  
  99. System.out.print("Telefono: ");
  100. telefono = scanner.nextLine();
  101.  
  102. System.out.print("Correo: ");
  103. correo = scanner.nextLine();
  104.  
  105. System.out.print("Tus datos han sido cambiados, " + nombre);
  106. break;
  107.  
  108. //case 3:
  109. //case 4:
  110. // ...
  111. }
  112.  
  113. System.out.println("");
  114. System.out.println("");
  115. System.out.println("");
  116.  
  117. System.out.println("Hola, " + nombre + " " + apellido1 + " " + apellido2);
  118. System.out.println("¿Que quieres hacer?");
  119. System.out.println("1. Revisar tus datos");
  120. System.out.println("2. Editar tus datos");
  121. System.out.println("3. Salir");
  122. System.out.print("---> ");
  123.  
  124. opcion = Integer.parseInt(scanner.nextLine());
  125.  
  126.  
  127.  
  128.  
  129. }
  130. while (opcion < 3);
  131. //repite estos comandos hasta que la variable "opcion" sea igual o mayor a 3
  132.  
  133.  
  134. }
  135. }
  136.  
  137. /*
  138. ACTUALIZACIONES:
  139. - Hacer la interfaz más visual
  140. - Poner más opciones
  141. - Verificacion de campos
  142. - Error al ser menor de edad
  143. - Base de datos de usuarios
  144. - Acceder a otros ficheros con permisos y usuarios
  145. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement