Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.util.Arrays;
  3.  
  4. public class main {
  5. public static void main(String[] args) {
  6. int ingresado;
  7. boolean bandera = true;
  8. String opcion;
  9. String[] opciones = {"Agregar", "Borrar", "Editar", "Visualizar", "Cancelar"};
  10.  
  11. estudiantes[] alumnosAR = new estudiantes[3];
  12.  
  13.  
  14. while(bandera){
  15. ingresado = JOptionPane.showOptionDialog(null, "Que quieres hacer?", "Presiona un boton", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, opciones[0]);
  16.  
  17. switch (ingresado){
  18. case 0:
  19. for(int i = 0; i < alumnosAR.length; i++){
  20. alumnosAR[i] = new estudiantes();
  21. }
  22. for(int i = 0; i < alumnosAR.length; i++){
  23. System.out.println(alumnosAR[i].getNombre() + " " + alumnosAR[i].getCarrera() + " " + alumnosAR[i].getMatricula());
  24. }
  25. break;
  26. case 1:
  27.  
  28. break;
  29. case 2:
  30.  
  31. break;
  32.  
  33. case 3:
  34. JOptionPane.showMessageDialog(null, Arrays.toString(alumnosAR));
  35. break;
  36. }
  37. opcion = JOptionPane.showInputDialog(null, "Que quieres hacer? \n 1.Volver \n 2.Salir");
  38. if (Integer.parseInt(opcion) == 1){
  39. bandera = true;
  40. } else {
  41. bandera = false;
  42. }
  43. }
  44.  
  45. }
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. import jdk.nashorn.internal.scripts.JO;
  55.  
  56. import javax.swing.*;
  57.  
  58. public class estudiantes {
  59.  
  60. private String matricula;
  61. private String nombre;
  62. private String carrera;
  63.  
  64.  
  65. public void setNombre(String nombre){
  66. this.nombre = nombre;
  67. }
  68.  
  69. public String getNombre() {
  70. return this.nombre;
  71. }
  72.  
  73. public void setMatricula(String nombre){
  74. this.matricula = matricula;
  75. }
  76.  
  77. public String getMatricula() {
  78. return this.matricula;
  79. }
  80.  
  81. public void setCarrera(String nombre){
  82. this.carrera = carrera;
  83. }
  84.  
  85. public String getCarrera() {
  86. return this.carrera;
  87. }
  88.  
  89. estudiantes(){
  90. nombre = JOptionPane.showInputDialog(null, "Ingresa el nombre:");
  91. carrera = JOptionPane.showInputDialog(null, "Ingresa la carrera:");
  92. matricula = JOptionPane.showInputDialog(null, "Ingresa la matricula:");
  93.  
  94. }
  95.  
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement