viernes, 28 de noviembre de 2014

FORMULARIO 2
ELECCIÓN DE CARRERAS

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author CBTIS73
 */
public class EleccionDeCarreras extends javax.swing.JFrame {
void aceptar(){
    String mensaje=("Carreras Elegidas:");
    if(chkDerecho.isSelected()){
        mensaje= mensaje+"Derecho";
    }
    if(chkSistemas.isSelected()){
        mensaje= mensaje+"Sistemas";
    }
    if(chkContab.isSelected()){
        mensaje= mensaje+"Contabilidad";
    }
    if(chkEcono.isSelected()){
        mensaje= mensaje+"Economia";
    }
    lblRespuesta.setText(mensaje);
}
void limpiar(){
    lblRespuesta.setText("");
    if (chkDerecho.isSelected()){
        chkDerecho.setSelected(false);
    }
    if(chkContab.isSelected()){
        chkSistemas.setSelected(false);
    }
    if(chkContab.isSelected()){
        chkContab.setSelected(false);
    }
    if (chkEcono.isSelected()){
        chkEcono.setSelected(false);
    }
}

    /**
     * Creates new form EleccionDeCarreras
     */
    public EleccionDeCarreras() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        chkDerecho = new javax.swing.JCheckBox();
        chkSistemas = new javax.swing.JCheckBox();
        chkContab = new javax.swing.JCheckBox();
        chkEcono = new javax.swing.JCheckBox();
        btnAceptar = new javax.swing.JButton();
        btnNuevo = new javax.swing.JButton();
        lblRespuesta = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(153, 0, 153));
        jLabel1.setText("Eleccion de carreras");

        chkDerecho.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        chkDerecho.setForeground(new java.awt.Color(0, 153, 153));
        chkDerecho.setText("Derecho");
        chkDerecho.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkDerechoActionPerformed(evt);
            }
        });

        chkSistemas.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        chkSistemas.setForeground(new java.awt.Color(0, 204, 204));
        chkSistemas.setText("Sistemas");

        chkContab.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        chkContab.setForeground(new java.awt.Color(0, 102, 102));
        chkContab.setText("Contabilidad");

        chkEcono.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        chkEcono.setForeground(new java.awt.Color(0, 153, 102));
        chkEcono.setText("Economia");

        btnAceptar.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnAceptar.setText("Aceptar");
        btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptarActionPerformed(evt);
            }
        });

        btnNuevo.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnNuevo.setText("Nuevo");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(132, 132, 132)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(89, 89, 89)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(chkSistemas)
                            .addComponent(chkDerecho)
                            .addComponent(chkContab)
                            .addComponent(chkEcono)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblRespuesta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btnAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(41, 41, 41)
                                .addComponent(btnNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(85, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(chkDerecho)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(chkSistemas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(chkContab)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(chkEcono)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnAceptar)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(1, 1, 1)))
                .addGap(26, 26, 26)
                .addComponent(lblRespuesta, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19))
        );

        pack();
    }// </editor-fold>                        

    private void chkDerechoActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
    }                                          

    private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {                                           
      aceptar();  // TODO add your handling code here:
    }                                          

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {                                         
       limpiar(); // TODO add your handling code here:
    }                                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new EleccionDeCarreras().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JCheckBox chkContab;
    private javax.swing.JCheckBox chkDerecho;
    private javax.swing.JCheckBox chkEcono;
    private javax.swing.JCheckBox chkSistemas;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel lblRespuesta;
    // End of variables declaration                   
}

miércoles, 26 de noviembre de 2014

FORMULARIO 1 
CONTADOR DE VOCALES


/** To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vocales;

/**
 *
 * @author CBTIS73
 */
public class Vocales26 extends javax.swing.JFrame {
void aceptar(){
    
    
    
    String texto;
    int x;
    texto=txtCuenta.getText();
    int cuentavocales=0;
    for (x=0; x<texto.length();x++){
        if((texto.charAt(x)=='a')||
          (texto.charAt(x)=='e')||
          (texto.charAt(x)=='i')||
          (texto.charAt(x)=='o')||
          (texto.charAt(x)=='u')){
            cuentavocales++;
        }
   
  }
lblRespuesta.setText("El texto"+"'"+ texto +"'"+"contiene"+cuentavocales+"vocales");
  }   
void limpiar(){
    txtCuenta.setText("");
    lblRespuesta.setText("");
}
    /**
     * Creates new form Vocales26
     */
    public Vocales26() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        btnAceptar = new javax.swing.JButton();
        btnNuevo = new javax.swing.JButton();
        lblRespuesta = new javax.swing.JLabel();
        txtCuenta = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Vijaya", 1, 36)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(102, 0, 0));
        jLabel1.setText("Contador de vocales");

        jLabel2.setFont(new java.awt.Font("Vivaldi", 1, 48)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 0, 0));
        jLabel2.setText("contador de vocales");

        jLabel3.setFont(new java.awt.Font("Vivaldi", 1, 24)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(51, 51, 0));
        jLabel3.setText("Ingrese el texto");

        btnAceptar.setForeground(new java.awt.Color(204, 0, 0));
        btnAceptar.setText("Aceptar");
        btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptarActionPerformed(evt);
            }
        });

        btnNuevo.setForeground(new java.awt.Color(204, 0, 0));
        btnNuevo.setText("Nuevo");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });

        txtCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCuentaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(70, 70, 70)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblRespuesta, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(jLabel2)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(115, 115, 115)
                .addComponent(btnAceptar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnNuevo)
                .addGap(70, 70, 70))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(48, 48, 48)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAceptar)
                    .addComponent(btnNuevo))
                .addGap(47, 47, 47)
                .addComponent(lblRespuesta, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {                                           
      aceptar();  // TODO add your handling code here:
    }                                          

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {                                         
    limpiar();        // TODO add your handling code here:
    }                                        

    private void txtCuentaActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                         

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Vocales26.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Vocales26.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Vocales26.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Vocales26.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Vocales26().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel lblRespuesta;
    private javax.swing.JTextField txtCuenta;
    // End of variables declaration                   
}

PROGRAMA 25 
Se tienen las calificaciones del primer parcial de los alumnos de 2 materias, la materia A y la materia B, cada materia cuenta con 5 alumnos.
Realizar un programa en Java que muestre la materia que obtuvo el mejor promedio general.

import java.util.Scanner;
public class Parcial {
    private Scanner teclado;
    private int[] materiaA;
    private int[] materiaB;
    private int[] suma;
    public void cargar(){
        teclado= new Scanner (System.in);
        materiaA= new int[5];
        materiaB= new int[5];
        System.out.println("calificaciones de la materiaA");
        for (int f=0; f<5; f++){
            System.out.print("Ingrese calificaciones:");
            materiaA[f]= teclado.nextInt();
        }
        System.out.println("Calificaciones de la materia B");
    for (int f=0; f<5; f++){
        System.out.print("Ingrese calificaciones:");
        materiaB[f]= teclado.nextInt();
        }         
    }
   public void cargarPromedio(){
       int suma1=0;
       int suma2=0;
       for (int f=0; f<5; f++){
           suma1= suma1+materiaA[f];
           suma2= suma2+materiaB[f];
       }
       float PromedioA= suma1/5;
       float PromedioB= suma2/5;
       if (PromedioA>PromedioB){
           System.out.println("La materiaA tiene promedio mayor");
       }
       else{
           System.out.println("La materiaB tiene promedio mayor");
       }
   }
   public static void main(String[]ar){
       Parcial pv=new Parcial();
       pv.cargar();
       pv.cargarPromedio();
       }
   }
               
    

PROGRAMA 24
Una empresa tiene 2 turnos (mañana y tarde) en las que trabajan 8 empleados (4 por la mañana y 4 por la tarde). 
Confeccionar un programa que permita almacenar los sueldos de los empleados agrupados por turno.
Imprimir los gastos en sueldo de cada turno.

import java.util.Scanner;
public class PruebaVector3 {
   private Scanner teclado;
   private float[]sueldosM;
   private float[]sueldosT;
   float sumaT, sumaM, sueldoT, Turno,sueldo=0;
   int emp, A, B;
   public void cargar()
   {
       sumaM=0;
       sumaT=0;
       teclado= new Scanner (System.in);
       sueldosM= new float[4];
       sueldosT= new float[4];
       for(int emp=0; emp<8; emp++){
           System.out.println("Ingrese el turno:");
           //* si el turno es en la mañana escribir 1, si es en la tarde escribir 2*//
           Turno= teclado.nextFloat();
           System.out.println("Ingrese el sueldo:");
           sueldo= teclado.nextFloat();
           if (Turno>0 && Turno<2){
               sumaM= sumaM+sueldo;
           }
           else{
               if (Turno>1 && Turno>3){
                   sumaT= sumaT+sueldo;
               
           }
       }}}
       public void imprimir(){
           System.out.print("Importe turno de la mañana:");
           System.out.println(sumaM);
           System.out.print("Importe turno de la tarde:");
           System.out.println(sumaT);
       }
       public static void main (String[]ar){
           PruebaVector3 pv= new PruebaVector3();
           pv.cargar();
           pv.imprimir();
               }
           }

PROGRAMA 23 
Realizar un programa en lenguaje JAVA que defina un vector de tamaño 5 y de tipo Float que representen las alturas de 5 personas, obtener el promedio de las mismas. Contar cuantas personas son mas altas que el promedio y cuantas mas bajas.

import java.util.Scanner;
public class Alturas {
    private Scanner teclado;
    private float[] Alturas;float Altura=0,Promedio,MA=0,MB=0;
    public void cargar(){

    teclado= new Scanner(System.in);
    Alturas= new float[5];
    for (int f=0; f<5; f++){
        System.out.print("Ingrese la altura:");
        Alturas[f]= teclado.nextFloat(); 
        Altura= Altura+Alturas[f];
    }}
    public void Promedio(){
        Promedio= Altura/5;
        System.out.print("El promedio de las alturas es:");
        System.out.println(Promedio);
    }
    public void mayormenor(){
        for (int f=0; f<5; f=f+1){
            if (Alturas[f]>Promedio){
                MA= MA+1;
            }else{
                MB= MB+1;
            }}
        System.out.print("La cantidad de personas mas altas que el promedio son:");
        System.out.println(MA);
        System.out.print("La cantidad de personas mas bajas que el promedio son:");
        System.out.println(MB);
    }
    public static void main(String[]ar){
        Alturas a=new Alturas();
        a.cargar(); a.Promedio(); a.mayormenor();
        }
        
        
    }

viernes, 21 de noviembre de 2014

PROGRAMA 22
Se desea guardar los sueldos de 5 operarios. Según lo que se conoce deberá de definir 5 variables si queremos tener en un cierto momento los 5 sueldos almacenados en memoria. Empleando un vector solo se requiere definir un único nombre y accedemos a cada elemento por medio del subindice.

import java.util.Scanner;
public class PruebaVector1 {
    private Scanner teclado;
private int[]sueldos;
public void cargar()
{
  teclado=new Scanner(System.in);
  sueldos=new int[5];
  for (int f=0;f<5;f++){
      System.out.print("ingrese el sueldo:");
      sueldos[f]=teclado.nextInt();
 } 
}
public void imprimir(){
    for(int f=0; f<5; f++){
        System.out.println(sueldos[f]);
    }
}
    public static void main (String[]ar){
    PruebaVector1 pv=new PruebaVector1();
    pv.cargar();
    pv.imprimir();
}
    
}


    

MATRIZ UNIDIMENSIONAL( )


Se han empleado variables de distinto tipo para el almacenamiento de datos (variables, int, float, String). En esta ocacion se vera otro tipo de variables que permiten almacenar un conjunto de datos en una única variable.

Un vector es una estructura de datos que permite almacenar un conjunto de datos del mismo tipo. Con un único nombre se define un vector y por medio de un subindice se hace referencia a cada elemento del mismo.