Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.util.Arrays;
- public class main {
- public static void main(String[] args) {
- int ingresado;
- boolean bandera = true;
- String opcion;
- String[] opciones = {"Agregar", "Borrar", "Editar", "Visualizar", "Cancelar"};
- estudiantes[] alumnosAR = new estudiantes[3];
- while(bandera){
- ingresado = JOptionPane.showOptionDialog(null, "Que quieres hacer?", "Presiona un boton", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, opciones[0]);
- switch (ingresado){
- case 0:
- for(int i = 0; i < alumnosAR.length; i++){
- alumnosAR[i] = new estudiantes();
- }
- for(int i = 0; i < alumnosAR.length; i++){
- System.out.println(alumnosAR[i].getNombre() + " " + alumnosAR[i].getCarrera() + " " + alumnosAR[i].getMatricula());
- }
- break;
- case 1:
- break;
- case 2:
- break;
- case 3:
- JOptionPane.showMessageDialog(null, Arrays.toString(alumnosAR));
- break;
- }
- opcion = JOptionPane.showInputDialog(null, "Que quieres hacer? \n 1.Volver \n 2.Salir");
- if (Integer.parseInt(opcion) == 1){
- bandera = true;
- } else {
- bandera = false;
- }
- }
- }
- }
- import jdk.nashorn.internal.scripts.JO;
- import javax.swing.*;
- public class estudiantes {
- private String matricula;
- private String nombre;
- private String carrera;
- public void setNombre(String nombre){
- this.nombre = nombre;
- }
- public String getNombre() {
- return this.nombre;
- }
- public void setMatricula(String nombre){
- this.matricula = matricula;
- }
- public String getMatricula() {
- return this.matricula;
- }
- public void setCarrera(String nombre){
- this.carrera = carrera;
- }
- public String getCarrera() {
- return this.carrera;
- }
- estudiantes(){
- nombre = JOptionPane.showInputDialog(null, "Ingresa el nombre:");
- carrera = JOptionPane.showInputDialog(null, "Ingresa la carrera:");
- matricula = JOptionPane.showInputDialog(null, "Ingresa la matricula:");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement