<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1185936420227849811</id><updated>2026-10-25T03:04:24.920-06:00</updated><category term="Programacion Estructurada"/><category term="Programacion Orientada a Objetos"/><category term="Estructuras de Datos"/><category term="Básico"/><category term="Métodos Numéricos"/><category term="Tópicos Selectos de Programacion"/><category term="Graficación"/><title type='text'>Buenas intenciones</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00837924052584084269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>90</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-1306465156625246915</id><published>2013-10-02T20:07:00.001-05:00</published><updated>2013-10-02T20:07:14.681-05:00</updated><title type='text'>Juego del ahorcado en Java</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
El semestre pasado lleve la materia de &lt;b&gt;graficación&lt;/b&gt;, y me pidieron que realizara este juego; en si no tiene una gran interfaz, aparte que solo lo hice en un día, lo comparto con ustedes para que si llegan a hacerlo, no comiencen de cero como yo, y se les haga mas fácil.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El juego esta dividido en tres clases. La clase &lt;b&gt;Palabra &lt;/b&gt;es la encargada del manejo de las palabras que pueden ser elejidas para que el jugador trate de adivinar cual es (las palabras son nombres de animes), también esta clase hace las comparaciones de letras para ver si la letra que escriba el usuario se encuentra dentro de la palabra que el programa eligió.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La clase &lt;b&gt;Pintar&lt;/b&gt; es la encargada de pintar el &quot;muñeco&quot; con ayuda de los métodos &lt;b&gt;paint&lt;/b&gt; y&lt;b&gt; repaint&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y por ultimo la clase &lt;b&gt;Ahorcado&lt;/b&gt; es donde esta toda la interfaz gráfica del juego.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si tienen alguna duda sobre alguna parte del código comenten en nuestro Facebook para una pronta respuesta.&amp;nbsp;&lt;a href=&quot;https://www.facebook.com/BuenasIntencions&quot; target=&quot;_blank&quot;&gt;.facebook.com/BuenasIntencions&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
Descarga el proyecto&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/download/v95ve0h8a4s44gd/Ahorcado.zip&quot; target=&quot;_blank&quot;&gt;AQUI&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
NOTA: El proyecto fue creado utilizando NetBeans 7.1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHKX3FsXsb3b8amXLMFJvIrOTc4MITsOsdfE8zbUP2ysO0wvJD47gKjICId5lFVXa7YFF9-KbLjakvAJMezwpiISA5nlXyBZBJsV9pl5UQ0vveVkGIvFOznK4zcd1SqIyONX2sLUkVTy4d/s1600/ahorcado.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHKX3FsXsb3b8amXLMFJvIrOTc4MITsOsdfE8zbUP2ysO0wvJD47gKjICId5lFVXa7YFF9-KbLjakvAJMezwpiISA5nlXyBZBJsV9pl5UQ0vveVkGIvFOznK4zcd1SqIyONX2sLUkVTy4d/s400/ahorcado.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/1306465156625246915/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/10/juego-del-ahorcado-en-java.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1306465156625246915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1306465156625246915'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/10/juego-del-ahorcado-en-java.html' title='Juego del ahorcado en Java'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHKX3FsXsb3b8amXLMFJvIrOTc4MITsOsdfE8zbUP2ysO0wvJD47gKjICId5lFVXa7YFF9-KbLjakvAJMezwpiISA5nlXyBZBJsV9pl5UQ0vveVkGIvFOznK4zcd1SqIyONX2sLUkVTy4d/s72-c/ahorcado.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-1478927844598972229</id><published>2013-07-10T21:14:00.002-05:00</published><updated>2016-10-30T01:46:54.403-05:00</updated><title type='text'>Operaciones básicas en java</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Últimamente &amp;nbsp;descuidamos el blog un poco (por las vacaciones de verano), hace algunos días una seguidora del blog nos contacto para resolver algunas dudas, lamentablemente por falta de tiempo resolvimos sus dudas un poco después de tiempo. Pero ella logro terminar su programa y quiere compartirlo con nosotros y ustedes también.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Es un programa que pide una entrada (un numero entero) y realiza las 4 operaciones basicas. El programa usa JOptionPane para pedir y mostrar los datos, también otra cosa que debo mencionar es que el programa implementa el uso de funciones.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Les dejo el código aquí:&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;script src=&quot;https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&amp;skin=default&quot; defer=&quot;defer&quot;&gt;

/**
 * Archivo: Operaciones.java
 * @autor Sandra Glezh
 **/

import javax.swing.JOptionPane;

public class Operaciones
{
  public static void main(String[] args) 
  {
    String valor;
    valor=JOptionPane.showInputDialog(&quot;Introduzca un numero:&quot;); 

    int NUMERO_01,NUMERO_02,OP_SUMA,OP_RESTA,OP_MULTIPLICACION;
    float OP_DIVISION;
    NUMERO_01=Integer.parseInt(valor); 
    NUMERO_02=Integer.parseInt(valor); 


    OP_SUMA = SUMA(NUMERO_01,NUMERO_02);
    OP_RESTA = RESTA(NUMERO_01,NUMERO_02);
    OP_MULTIPLICACION = MULTIPLICACION(NUMERO_01,NUMERO_02);
    OP_DIVISION = DIVISION(NUMERO_01,NUMERO_02);

    IMPRIMIR_RESULTADOS(OP_SUMA,OP_RESTA,OP_MULTIPLICACION,OP_DIVISION);
  }

  public static int LEER_NUMERO(String NOMBRE_NUMERO)
  {
    int NUMERO=0; 
    JOptionPane.showMessageDialog(null,&quot;indique el&quot;+NOMBRE_NUMERO);
    return (NUMERO);
  }

  public static int SUMA(int NUM_01, int NUM_02)
  {
    int SUMA;
    SUMA = NUM_01 + NUM_02;
    return SUMA;
  }

  public static int RESTA(int NUM_01, int NUM_02)
  {
    int RESTA;
    RESTA = NUM_01 - NUM_02;
    return RESTA;
  }

  public static int MULTIPLICACION(int NUM_01, int NUM_02)
  {
    int MULTIPLICACION;
    MULTIPLICACION = NUM_01 * NUM_02;
    return MULTIPLICACION;
  }
 
  public static float DIVISION(int NUM_01, int NUM_02)
  {
    float DIVISION;
    DIVISION = (float)(NUM_01/NUM_02);
    return DIVISION;
  }

  public static void IMPRIMIR_RESULTADOS(int S,int R,int M,float D)
  {
    JOptionPane.showMessageDialog(null,&quot;LOS RESUTLADOS SON : \n&quot;);
    JOptionPane.showMessageDialog(null,&quot;SUMA : &quot; + S);
    JOptionPane.showMessageDialog(null,&quot;RESTA : &quot; + R);
    JOptionPane.showMessageDialog(null,&quot;MULTIPLICACION : &quot; + M);
    JOptionPane.showMessageDialog(null,&quot;DIVISION : &quot; + D);
  }
}



&lt;/script&gt;



&lt;br /&gt;
&lt;br /&gt;
Ahora solo les queda probar el programa en sus computadoras. ¡Hagamos código!

Pueden descargarlo de aquí:&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/download/5fqavubrv2bcprh/Operaciones.java&quot; target=&quot;_blank&quot;&gt;Operaciones.java&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/1478927844598972229/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/operaciones-basicas-en-java.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1478927844598972229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1478927844598972229'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/operaciones-basicas-en-java.html' title='Operaciones básicas en java'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-4663201909337473714</id><published>2013-07-10T20:41:00.000-05:00</published><updated>2016-11-01T23:47:09.609-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Inicio en java Ejemplo 3</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Siguiendo con el tercer ejercicio de Inicio en java, se plantea el siguiente problema:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;i&gt;Hacer un programa en java que solicite al usuario el monto de los dolares a convertir en pesos mexicanos y solicite también la tasa actual de cambio por dolar. El programa visualizara el resultado de conversión de dolares a pesos mexicanos.&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif;&quot;&gt;CÓDIGO&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;


&lt;script src=&quot;https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&amp;skin=desert&quot; defer=&quot;defer&quot;&gt;&lt;/script&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;

/**
 * Archivo: Conversion.java
 * @autor BelloCerecero
 * @since 10-jul-2013
 **/

import java.util.Scanner;

public class Conversion
{
  public static void main(String[] args) 
  {
    //Creamos el objeto teclado
    //Para interactuar con el usuario por consola
    Scanner teclado = new Scanner(System.in);

    //Solicitamos el monto a convertir 
    System.out.println(&quot;Ingrese el monto: &quot;);

    //Guardamos el monto a convertir
    double dolares = teclado.nextDouble();

    //Solicitamos la tasa actual de cambio
    System.out.println(&quot;Ingrese tasa actual de cambio: &quot;);

    //Guardamos la tasa actual de cambio
    double tasa = teclado.nextDouble();

    //Hacemos la conversion
    double conversion = tasa * dolares;

    //Imprimimos
    System.out.println(dolares + &quot; dolares es igual a &quot; + conversion + &quot; pesos&quot;);
  }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Comenzaremos en la linea 7, aquí estamos importando la clase &lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Scanner&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt; para poder interactuar con el usuario por medio de la consola.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;En la linea 9 creamos la clase Conversion y en la linea 11 creamos el main.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Ahora en la linea 15 instanciamos &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&lt;i&gt;Scanner&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt; para poder usar sus métodos; En la linea 18 imprimimos en consola &quot;Ingrese el monto&quot; el usuario tendrá que ingresar el monto en dolares que quiere convertir a pesos. Para esto en la linea 21 guardamos esa cantidad que ingresara.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;En la linea 24 imprimimos en consola &amp;nbsp;&quot;Ingrese tasa actual de cambio&quot; en esta parte el usuario tendrá que ingresar la tasa de cambio vigente, ahora guardamos ese valor (linea 27).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;En esta pagina pueden encontrar la tasa de cambio actual:&amp;nbsp;&lt;a href=&quot;http://www.cambiodolar.mx/&quot; target=&quot;_blank&quot;&gt;http://www.cambiodolar.mx/&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;En la linea 30 solo estamos haciendo la conversión de dolares a pesos con una &amp;nbsp;simple multiplicación.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Y por ultimo en la linea 33 imprimimos la conversión.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;La salida del programa es la siguiente:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIZcsGV8JDPN23eraOezpHj5G3qwzRzHhGonZ82wE_ZaPPyjq8k-sUPPxYcM1-oWHWAWLiKeqcdJgRfAwzLB6e6LCybSx1WWFluaLaJ-K91Ow4MDt2WUstxMoh3zPHbK27HLplGYODnbCz/s1600/Captura+de+pantalla+de+2013-07-10+20:36:57.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIZcsGV8JDPN23eraOezpHj5G3qwzRzHhGonZ82wE_ZaPPyjq8k-sUPPxYcM1-oWHWAWLiKeqcdJgRfAwzLB6e6LCybSx1WWFluaLaJ-K91Ow4MDt2WUstxMoh3zPHbK27HLplGYODnbCz/s400/Captura+de+pantalla+de+2013-07-10+20:36:57.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Descarga el código:&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/download/84jl31575qxq5vd/Conversion.java&quot; target=&quot;_blank&quot;&gt;Conversion.java&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/4663201909337473714/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-3.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4663201909337473714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4663201909337473714'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-3.html' title='Inicio en java Ejemplo 3'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIZcsGV8JDPN23eraOezpHj5G3qwzRzHhGonZ82wE_ZaPPyjq8k-sUPPxYcM1-oWHWAWLiKeqcdJgRfAwzLB6e6LCybSx1WWFluaLaJ-K91Ow4MDt2WUstxMoh3zPHbK27HLplGYODnbCz/s72-c/Captura+de+pantalla+de+2013-07-10+20:36:57.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-212493829349757562</id><published>2013-07-10T18:04:00.001-05:00</published><updated>2013-07-10T18:07:11.023-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Inicio en java Ejemplo 2</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Este es el segundo ejercicio que va enfocado a personas que estén en su primer curso de java, como les había comentado anteriormente estos programas los realice yo en mi primer curso de java, sin mas que decir aquí el ejercicio:&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;Solicite el total a pagar de medicamentos en una farmacia. El programa debe de calcular el descuento obtenido del 8% en la venta y el total a pagar por el cliente menos el descuento, imprima el total que se pago según la venta , el descuento que se realizo y el pago de la venta menos el descuento.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;b&gt;&lt;i&gt;CÓDIGO&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: Farmacia.java
 * @autor BelloCerecero
 * @since 10-jul-2013
 **/

import java.util.Scanner;

public class Farmacia
{
  public static void main(String args[])
  {
    //Creamos el objeto teclado
    //Para interactuar con el usuario por consola
    Scanner teclado = new Scanner(System.in);

    //Le solicitamos el total a pagar
    System.out.println(&quot;Ingrese el total a pagar: &quot;);

    //Guardamos el total a pagar
    double totalPagar = teclado.nextDouble();

    //Obtenemos el 8% de descuento
    double descuento = (8*100)/totalPagar;

    //Obtenemos el total menos el descuento
    double venta = totalPagar - descuento;

    //Imprimimos todo lo que se nos pide
    System.out.println(&quot;Pago de la venta: &quot; + totalPagar);
    System.out.println(&quot;Descuento: &quot; + descuento);
    System.out.println(&quot;Total: &quot; + venta);
  }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Bien, entonces nos ubicamos en la linea 7, aquí estamos importando la clase &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;i&gt;&lt;b&gt;Scanner&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; para poder interactuar con el usuario por medio de la consola. En la linea 9 creamos nuestra clase a la que llamaremos &quot;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;i&gt;Farmacia&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&quot; y en la linea 11 creamos el &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;i&gt;&lt;b&gt;main&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; para que el programa pueda ejecutarse.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;En la linea 15 estamos instanciando la clase &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;i&gt;&lt;b&gt;Scanner&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; para poder usar sus&amp;nbsp;métodos&amp;nbsp; En la linea 18 imprimimos en consola un mensaje para que el usuario introduzca el total a pagar.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;En la linea 21 declaramos una variable de tipo &lt;/span&gt;&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;double&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; (Por si hay centavos) y en ella guardaremos lo que el usuario halla introducido (para eso se usa &quot;&lt;/span&gt;&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;teclado.nextDouble()&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&quot;).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;En la linea 24 declaramos una variable de tipo &lt;/span&gt;&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;double&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; (por si hay decimales), en esta variable guardaremos el resultado de la siguiente operación: &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;i&gt;(8*100)/totalPagar&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Que no es mas que una regla de tres para obtener el 8% del total a pagar.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;En la linea 27 declaramos una ultima variable de tipo &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;i&gt;double&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt; (por si hay decimales), aquí guardaremos la resta del total a pagar menos el ocho por ciento de descuento.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Ya por ultimo hacemos las impresiones.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;En la linea 30 imprimimos el total a pagar (sin el descuento), en la linea 31 imprimimos el descuento que se aplicara y en la linea 32 imprimimos el total a pagar pero ya con el descuento.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;La salida del programa es:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSf_2i0LLzBpTThrKKB7rMcyTjtj_lqKC16eXwrkoEuAhtSedZBSR1Gj85yrN-z55N1OZSF6oduu2V2BzBg1Hl-XmA1HgzE1BBKgN7YLCqTrahoV9iIwV0k7r6IQN5K645KPgvaoxj8xfF/s1600/Captura+de+pantalla+de+2013-07-10+18:01:08.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSf_2i0LLzBpTThrKKB7rMcyTjtj_lqKC16eXwrkoEuAhtSedZBSR1Gj85yrN-z55N1OZSF6oduu2V2BzBg1Hl-XmA1HgzE1BBKgN7YLCqTrahoV9iIwV0k7r6IQN5K645KPgvaoxj8xfF/s400/Captura+de+pantalla+de+2013-07-10+18:01:08.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Descarga el código:&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/download/9z2pp4r9j5bqhev/Farmacia.java&quot; target=&quot;_blank&quot;&gt;Farmacia.java&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/212493829349757562/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-2.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/212493829349757562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/212493829349757562'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-2.html' title='Inicio en java Ejemplo 2'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSf_2i0LLzBpTThrKKB7rMcyTjtj_lqKC16eXwrkoEuAhtSedZBSR1Gj85yrN-z55N1OZSF6oduu2V2BzBg1Hl-XmA1HgzE1BBKgN7YLCqTrahoV9iIwV0k7r6IQN5K645KPgvaoxj8xfF/s72-c/Captura+de+pantalla+de+2013-07-10+18:01:08.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-998413935412567648</id><published>2013-07-10T01:07:00.001-05:00</published><updated>2013-07-10T01:16:51.772-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Inicio en java Ejemplo 1</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Este sera el primero de varios programas que estaré publicando, estos programas están dirigidos para personas que están llevando su primer curso de java o estén interesados en aprender lo básico de este lenguaje. Estos programas que estaré publicando, podría decirse que son los clásicos ejercicios que tu profesor les explicara o dejara de tarea. Sin mas preámbulos comenzamos con el primero, bien, el planteamiento del ejercicio es el siguiente:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;Hacer un programa en java de una lista de 5 calificaciones, que calcule y almacene el promedio, y posteriormente que lo visualice en la pantalla. La lista de calificaciones son:&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;77&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;83&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;85&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;72&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;88&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;CÓDIGO&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: Calificicaciones.java
 * @Autor BelloCerecero
 * @Since 9-jul-2013
 **/

public class Calificaciones
{
  public static void main(String args[])
  { 
    //Declaración y asignacion de variables
    int calif1 = 77;
    int calif2 = 83;
    int calif3 = 85;
    int calif4 = 72;
    int calif5 = 88;
  
    //variable para almacenar el promedio
    double promedio;
  
    //Proceso para calcular el promedio
    promedio = (calif1 + calif2 + calif3 + calif4 + calif5)/5;
  
    //Imprimimos en consola
    System.out.println(&quot;El promedio es: &quot; + promedio);
   }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Bien, comenzamos en la linea 1 a la 5 estos son solo comentarios, en la linea 7 inicia nuestra clase a la que llamaremos &quot;Calificaciones&quot;, en la linea 9 iniciamos el &quot;main&quot;, en la linea 12 estamos declarando e inicializando las variables en donde guardaremos las 5 calificaciones, en la linea 19 declaramos una variable donde guardaremos el promedio de las 5 calificaciones. En la linea 22 hacemos la operación para obtener el promedio (sumamos las 5 calificaciones y las dividimos entre 5 y por ultimo en la linea 25 imprimimos en consola &quot;El promedio es: &quot; concatenando a la variable promedio.&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;La salida del programa es la siguiente:&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQe3kzckEeh3YhT46aOzj6CYkUpShthxhwBNhkwCxcR-EikXLys4kanZo695Eefog6VTXm9QRuu87IhpPNciOsXMarjzJ7Wlh40A8MvdTNpwM2bMUsF524Ujgv2mTBKj073D88t7ab8FR/s1600/Captura+de+pantalla+de+2013-07-10+00:56:15.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;72&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQe3kzckEeh3YhT46aOzj6CYkUpShthxhwBNhkwCxcR-EikXLys4kanZo695Eefog6VTXm9QRuu87IhpPNciOsXMarjzJ7Wlh40A8MvdTNpwM2bMUsF524Ujgv2mTBKj073D88t7ab8FR/s400/Captura+de+pantalla+de+2013-07-10+00:56:15.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Nota:&lt;/span&gt; El programa esta ejecutado en la terminal de Ubuntu 12.04 LTS, pero es 100% funcional en Windows, se puede usar la consola de windows para su ejecución o algún IDE como NetBeans o Eclipse. O en su defecto se puede usar también JCreator.&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Descarga el programa:&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.mediafire.com/download/pnrt96g6ksa5b9m/Calificaciones.java&quot; target=&quot;_blank&quot;&gt;Calificaciones.java&lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/998413935412567648/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-1.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/998413935412567648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/998413935412567648'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/07/inicio-en-java-ejemplo-1.html' title='Inicio en java Ejemplo 1'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQe3kzckEeh3YhT46aOzj6CYkUpShthxhwBNhkwCxcR-EikXLys4kanZo695Eefog6VTXm9QRuu87IhpPNciOsXMarjzJ7Wlh40A8MvdTNpwM2bMUsF524Ujgv2mTBKj073D88t7ab8FR/s72-c/Captura+de+pantalla+de+2013-07-10+00:56:15.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-4874767821700930184</id><published>2013-06-29T21:21:00.001-05:00</published><updated>2013-06-30T02:01:31.613-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Números Perfectos</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Hola amigos de Buenas Intenciones hoy les traigo a petición de un seguidor de buenas intenciones un programa de Números Perfectos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Bueno lo primero que debemos saber es ¿QUE ES UN NÚMERO PERFECTO?.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-size: 13px; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Un número es perfecto si es igual a la suma de todos sus divisores positivos sin incluir el propio número.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Por ejemplo, el número 6 es perfecto.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;El 6 tiene como divisores: 1, 2, 3 y 6 pero el 6 no se cuenta como divisor para comprobar si es perfecto.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Si sumamos 1 + 2 + 3 = 6&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; line-height: 18px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Los siguientes números perfectos después del 6 son&amp;nbsp;28, 496, 8128, 33550336, 8589869056.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Una vez explicado este punto pasamos al código de nuestro programa.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;package buenasintenciones;
/**
 * @author Ivan
 */
import javax.swing.JOptionPane;

public class NumerosPerfectos {
    public static void main(String[] args) {
        int i, suma= 0, numero;
         String numero1 = JOptionPane.showInputDialog(&quot;Ingrese el numero del 1 al 10000&quot;);
         numero= Integer.parseInt(numero1);
        for (i = 1; i &amp;lt; numero; i++) { 
            if (numero % i == 0) {
                suma = suma + i;   
            }
        }
        if (suma == numero) {  
            JOptionPane.showMessageDialog(null, &quot;El numero es perfecto&quot;);
        } else {
            JOptionPane.showMessageDialog(null, &quot;El numero no es perfecto&quot;);

        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Bueno lo primero que tenemos que hacer es declarar la libreria &lt;b&gt;JOptionPane &lt;/b&gt;para poder insertar nuestros datos más adelante, declaramos el nombre de nuestra clase en este caso es NumerosPerfectos, declaramos nuestro metodo main. En la linea 10 declaramos tres variables de tipo int con su nombre i, suma(esta con un valor inicial de 0) y numero. En la linea 11 declaramos una variable de tipo String con nombre numero1 y la igualamos con nuestro JOptionPane que sirve para insertar datos y colocamos el comentario entre comillas que queremos que nos muestre. En la 12 tenemos que convertir nuestro valor anterior a un valor entero que es igual a un valor de tipo int, esto ya que nuestro JOptionPane recibio un valor de tipo String. en nuestra linea 13 declaramos un ciclo for con las condiciones i=1, donde este valor i van a ser los divisores y los dividira hasta de 1 hasta n-1, en la linea 14 solo declaramos que si el valor de la suma es un un divisor se sume.&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;En la 18 declaramos nuestra condicion if diciendo que si es el valor de suma es igual a numero sera un valor perfecto y por ultimo nuestras salidas con un JOption de mensajes.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/4874767821700930184/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/numeros-perfectos.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4874767821700930184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4874767821700930184'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/numeros-perfectos.html' title='Números Perfectos'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03054566529239841799</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-5488353752170492605</id><published>2013-06-23T13:30:00.003-05:00</published><updated>2013-06-23T13:32:13.407-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><title type='text'>Herencia</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Cuando hablamos de la programación orientada a objetos es inevitable tratar con el tema de la Herencia, ya que es una de la principales características de este enfoque. La herencia es una característica que nos permite la creación de clases (&lt;i&gt;subclase&lt;/i&gt;) a partir de una clase ya creada (&lt;i&gt;superclase&lt;/i&gt;); de modo que cuando estemos creando una clase y decidimos que va a heredar de otra clase ya existente, lo la clase que estamos creando podrá hacer uno de los métodos y atributos de la clase que ya existe (de la cual heredamos).&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;Ejemplo:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Creamos una clase Persona y una clase Estudiante, distintas una de la otra:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglTrL_RsCjvhU5r-aCfzdKKuIgqxatgIJv3MUdlyWg6XUdopCgDrF8dTy8JSfSrc5SISGsYeduFpSnfrlC10POSqIELUhFJpnwq9I98LRY9cuZnCmFkBMV1cY6XKIrifV57FUWqzNHNjhT/s1600/clases.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglTrL_RsCjvhU5r-aCfzdKKuIgqxatgIJv3MUdlyWg6XUdopCgDrF8dTy8JSfSrc5SISGsYeduFpSnfrlC10POSqIELUhFJpnwq9I98LRY9cuZnCmFkBMV1cY6XKIrifV57FUWqzNHNjhT/s400/clases.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien estas son dos diferentes clases por separado, independientes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Pero pensemos que un estudiante también tiene los mismos atributos y los mismos métodos que una persona, pero una persona no necesita los mismos atributos y métodos que un estudiante. Entonces pensemos en que la clase estudiante puede heredar los métodos y atributos de la clase Persona, de tal modo que podríamos visualizar algo más o menos así:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
La clase Estudiante&amp;nbsp;&lt;b&gt;HEREDA&lt;/b&gt;&amp;nbsp;de la clase Persona:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsdVi38-uSe_JJ-EsJWczp3oXkb3r3TrEuvXXVzShPnyako_ev-D4cTkR4-yzDoLYjpZ1Me1ts6ndAQSQuQLUTXSV4JVFXRpjcV1eS8-gB0A2SIUH_CcddaAWmj2QqOAWNHGKO0TMo2x7V/s1600/clase2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsdVi38-uSe_JJ-EsJWczp3oXkb3r3TrEuvXXVzShPnyako_ev-D4cTkR4-yzDoLYjpZ1Me1ts6ndAQSQuQLUTXSV4JVFXRpjcV1eS8-gB0A2SIUH_CcddaAWmj2QqOAWNHGKO0TMo2x7V/s1600/clase2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El ejemplo anterior es una analogía con personas (un caso cotidiano) para dejar en claro la esencia de la Herencia. Ahora procederé a mostrarles un código de como se maneja la herencia en Java:&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 *Archivo: Persona.java
 * @author Anibal Clavel
 * http://www.buenasintencions.blogspot.mx
 */

public class Persona {
    
    //Declaracion de atributos:
    String nombre;
    int edad;
    
    //Constructor:
    public Persona(){
        
    }
    
    //Metodo dormir:
    public String domir(){
        return &quot;zZzzZ&quot;;
    }
    
    //Metodo comer:
    public String comer(){
        return &quot;comiendo...&quot;;
    }
    
    //Setters y Getters.
    public void setNombre(String n){
        nombre = n;
    }
    
    public void setEdad(int e){
        edad = e;
    }
    
    public String getNombre(){
        return nombre;
    }
    
    public int getEdad(){
        return edad;
    }
}// fin de la clase Persona.
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Creada la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt; con sus respectivos métodos, atributos, setters y getters. Esto como siempre hemos planteado la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt;, y debido a que es simple de entender, solo voy a decirles que a partir de esta clase vamos a crea una clase nueva, la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Estudiante&lt;/span&gt;. La clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Estudiante&lt;/span&gt; va a ser hija (va a heredar) de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt;, por lo tanto un objeto de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Estudiante&lt;/span&gt; podrá hacer uso de los métodos de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt; también.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora el código de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Estudiante&lt;/span&gt;, con sus métodos y atributos propios y con una linea de código donde indicamos que hereda de otra clase:

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 *Archivo: Estudiante.java
 * @author Anibal Clavel
 * http://www.buenasintencions.blogspot.mx
 */

public class Estudiante extends Persona{
    
    //Declaracion de atributos:
    String carrera, matricula;
    
    //Metodo estudiar:
    public String estudiar(String materia){
        return &quot;estudiando... &quot;+materia;
    }
    
    //Metodo hacer examen:
    public String hacerExamen(){
        return &quot;haciendo exmane&quot;;
    }
    
    //Setters y Getters
    public void setCarrera(String c){
        carrera = c;
    }
    
    public void setMatricula(String m){
        matricula = m;
    }
    
    public String getCarrera(){
        return carrera;
    }
    
    public String getMatricula(){
        return matricula;
    }
}//fin de la clase Estudiante.
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como ven la creación de esta clase es de la forma tradicional que siempre lo hacemos, a excepción de que en la linea 7 al momento de definir la clase&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; Estudiante&lt;/span&gt;, mediante la palabra reservada &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;extends&lt;/span&gt; le indicamos que esa clase va a heredar de otra clase, en este caso de &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para este momento ya tenemos creadas 2 clases diferentes, Persona y Estudiante (que hereda de la primera), creare una clase principal para hacer objetos de la clase estudiante y probar nuestra herencia:

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 *Archivo: Prueba.java
 * @author Anibal Clavel
 * http://www.buenasintencions.blogspot.mx
 */

import javax.swing.JOptionPane;

public class Prueba{
    
    public static void main(String args[]){
        
        String dato1;
        int dato2;
        Estudiante e = new Estudiante();
        
        dato1=JOptionPane.showInputDialog(&quot;Nombre:&quot;);
        e.setNombre(dato1);
        dato2=Integer.parseInt(JOptionPane.showInputDialog(&quot;Edad:&quot;));
        e.setEdad(dato2);
        dato1=JOptionPane.showInputDialog(&quot;Carrera:&quot;);
        e.setCarrera(dato1);
        dato1=JOptionPane.showInputDialog(&quot;Matricula:&quot;);
        e.setMatricula(dato1);
        
        System.out.println(&quot;El nombre de la persona es:&quot;);
        System.out.println(e.getNombre());
        System.out.println(&quot;\n...y su edad es: &quot;+e.getEdad());
        System.out.println(&quot;Estudia: &quot;+e.getCarrera());
        System.out.println(&quot;con matricula: &quot;+e.getMatricula());
        
        System.out.println(&quot;Tiene la capacidad de hacer estos metodos:&quot;);
        System.out.println(e.domir());
        System.out.println(e.comer());
        System.out.println(e.estudiar(&quot;Matematicas&quot;));
        System.out.println(e.hacerExamen());
    }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, en esta clase principal se crea un objeto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;e&lt;/span&gt; de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Estudiante&lt;/span&gt; y se hace uso de sus métodos, y también se hace uso de los métodos de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt; ya que puede utilizarlos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
De este modo es como funciona la herencia en la programación orientada a objetos en Java, permite que clases hijas puedan usar los métodos o atributos de clases padres, ahora podemos correr nuestro programa y observar los resultados obtenidos para un mejor entendimiento del tema y para probar como es que realmente ha sucedido la herencia.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/5488353752170492605/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/herencia.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/5488353752170492605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/5488353752170492605'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/herencia.html' title='Herencia'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00837924052584084269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglTrL_RsCjvhU5r-aCfzdKKuIgqxatgIJv3MUdlyWg6XUdopCgDrF8dTy8JSfSrc5SISGsYeduFpSnfrlC10POSqIELUhFJpnwq9I98LRY9cuZnCmFkBMV1cY6XKIrifV57FUWqzNHNjhT/s72-c/clases.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-8012236962632386135</id><published>2013-06-21T16:16:00.002-05:00</published><updated>2013-06-21T16:16:42.184-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Números aleatorios</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Los números aleatorios son de mucha utilidad en ciertas ocasiones, ya que, los podemos usar para ciertos programas que necesiten tomar decisiones sin la intervención del usuario. En fin, hoy hablaremos mas concretamente sobre como generar números aleatorios de tipo entero, para esto, hemos realizado el siguiente ejemplo:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;//Archivo: NumerosAleatorios.java

import java.util.Random;

public class NumerosAleatorios
{
  public static void main(String args[])
  {
    //Instanciamos la clase Random
    Random num = new Random();
    System.out.println(&quot;Numeros aleatorios generados:&quot;);
    System.out.println(num.nextInt(10));
    System.out.println(num.nextInt(10));
    System.out.println(num.nextInt(10));
    System.out.println(num.nextInt(10));
  }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, ya dentro del main (linea 9) hemos puesto un comentario, en la linea 10 es donde ya instanciamos la clase Random, para poder utilizarla. En la linea 11 hemos puesto una impresión solo para que salga &quot;Numeros aleatorios generados:&quot;, en la linea 12 hasta la 15, con ayuda de un System.out.println(); y usando la siguiente instrucción (dentro del System) num.nextInt(10); (num es el nombre de la instancia linea 10). Ahora algo importante, se preguntaran por que hemos puesto un 10 dentro, bueno ese 10 quiere decir, que, nos va a generar números aleatorios del 0.... al 10, si yo quisiera que me generara del 0... al 6 (por ejemplo), solo tendría que poner un 6 ejemplo:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;    System.out.println(num.nextInt(6));
&lt;/pre&gt;
&lt;br /&gt;
Entonces ya solo generaría números aleatorios del 0... al 6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
La salida del programa es la siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf0SP_YUJq_DSHWir56P5nmhkWXQKbiKDIP0Oeulh7aPxrQKo83boULg04MwinckZgZVeO46qS6snWs-0-ZsHIQPQAfuYpoMB3EtFYak0NpoyVuPbiLOEAAdHoYyvEw8C2r2wD1t3nbjeJ/s1600/Captura+de+pantalla+de+2013-06-21+15:56:13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf0SP_YUJq_DSHWir56P5nmhkWXQKbiKDIP0Oeulh7aPxrQKo83boULg04MwinckZgZVeO46qS6snWs-0-ZsHIQPQAfuYpoMB3EtFYak0NpoyVuPbiLOEAAdHoYyvEw8C2r2wD1t3nbjeJ/s320/Captura+de+pantalla+de+2013-06-21+15:56:13.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
NOTA: Si ejecutan el programa en sus computadoras, la salida sera diferente en cada ejecución puesto que son NÚMEROS ALEATORIOS.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/8012236962632386135/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/numeros-aleatorios.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8012236962632386135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8012236962632386135'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/numeros-aleatorios.html' title='Números aleatorios'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf0SP_YUJq_DSHWir56P5nmhkWXQKbiKDIP0Oeulh7aPxrQKo83boULg04MwinckZgZVeO46qS6snWs-0-ZsHIQPQAfuYpoMB3EtFYak0NpoyVuPbiLOEAAdHoYyvEw8C2r2wD1t3nbjeJ/s72-c/Captura+de+pantalla+de+2013-06-21+15:56:13.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-165585996750064866</id><published>2013-06-19T01:20:00.001-05:00</published><updated>2013-06-19T01:20:49.672-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><title type='text'>Setters y Getters</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Los setter y getters, son métodos de acceso en una clase, estos sirven para establecer y obtener datos de los atributos de nuestra clase, estos dos métodos deben ser públicos:&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
El método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;set&lt;/b&gt;&lt;/span&gt; (traducción al español: &lt;i&gt;&quot;establecer&quot;&lt;/i&gt;): nos sirve para asignar un valor (inicializar) a un atributo de nuestra clase, esto se hace de manera directa con este método, como este método no retorna nada, el nombre de este debe ser precedido por void, y siempre debe recibir un parámetro de entrada.&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
El método &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;get&lt;/span&gt;&lt;/b&gt; (traducción al español: &lt;i&gt;&quot;obtener&quot;&lt;/i&gt;): este tipo de método accede a la clase para retornarnos el valor de algún atributo que queramos, y como ya mencioné, el método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;get&lt;/span&gt; si debe retornar un valor por lo cual el nombre de este método debe ser precedido por el tipo de valor que vamos a retornar con ese método.&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A estos métodos se les suele hacer referencia en plural (como el titulo de este post) porque generalmente son más de un método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;set&lt;/span&gt; y &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;get&lt;/span&gt; en una clase, y de este modo nos referimos a todo ese tipo de métodos de establecimiento y obtención de información. Bien, estos métodos se ven así en una clase:&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 *Archivo: Persona.java
 * @author Anibal Clavel
 * http://www.buenasintencions.blogspot.mx
 */

public class Persona {
    
    //Declaracion de atributos:
    String nombre;
    int edad;
    
    //Constructor:
    public Persona(){
        
    }
    
    //Metodo dormir:
    public String domir(){
        return &quot;zZzzZ&quot;;
    }
    
    //Metodo comer:
    public String comer(){
        return &quot;comiendo...&quot;;
    }
    
    //Setters y Getters.
    public void setNombre(String n){
        nombre = n;
    }
    
    public void setEdad(int e){
        edad = e;
    }
    
    public String getNombre(){
        return nombre;
    }
    
    public int getEdad(){
        return edad;
    }
}// fin de la clase Persona.
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Acá creamos la clase Persona con 2 atributos, 1 constructor, 2 metodos, 2 setters y 2 getters. Los setters y getters comienzan en la linea 29 y como se puede observar el primer set es para establecer un nombre (&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String&lt;/span&gt;) a nuestro atributo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;nombre&lt;/span&gt; de la clase.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;setNombre()&lt;/span&gt;, pide como parámetro un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String&lt;/span&gt; (el nombre de la persona), el cual asigna a nuestro atributo nombre de la clase. Este método no retorna ningún valor. Solo establecimos un dato en un atributo de esta clase.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;getNombre()&lt;/span&gt;, no necesita de parámetros de entrada, solo devuelve al programa que lo este invocando (mediante un objeto de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Persona&lt;/span&gt;) el valor que contenga alojado el atributo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;nombre&lt;/span&gt;, retorna un valor &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Una vez que creamos nuestros métodos set y get y hayamos terminado la creación de nuestra clase, hacemos unos de estos métodos en la clase principal (o en otra clase que lo requiera), y se vera más o menos así:

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 *Archivo: Prueba.java
 * @author Anibal Clavel
 * http://www.buenasintencions.blogspot.mx
 */

import javax.swing.JOptionPane;

public class Prueba{
    
    public static void main(String args[]){
        
        String dato1;
        int dato2;
        Persona p = new Persona();
        
        dato1=JOptionPane.showInputDialog(&quot;Nombre:&quot;);
        p.setNombre(dato1);
        dato2=Integer.parseInt(JOptionPane.showInputDialog(&quot;Edad:&quot;));
        p.setEdad(dato2);
        
        System.out.println(&quot;El nombre de la persona es:&quot;);
        System.out.println(p.getNombre());
        System.out.println(&quot;\n...y su edad es: &quot;+p.getEdad());
    }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/165585996750064866/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/setters-y-getters.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/165585996750064866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/165585996750064866'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/setters-y-getters.html' title='Setters y Getters'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00837924052584084269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-5211288382698099286</id><published>2013-06-16T17:57:00.000-05:00</published><updated>2013-06-16T22:10:27.008-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Graficación"/><title type='text'>Cubo de Rubik en JAVA</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Hola amigos de &quot;Buenas Intenciones&quot;, en esta le explicare como hacer el cubo de Rubik utilizando las libreria de OpenGL, que es una libreria para graficos por computadora un poco mas avanzada donde utilizaremos codigo en java &amp;nbsp;3D, con textura, movimientos de cámara, traslación, rotación.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Primero veamos que es &lt;b&gt;&lt;u&gt;OpenGL&lt;/u&gt;&lt;/b&gt; proporciona una biblioteca básica de funciones para especificar primitivas gráficas, atributos, transformaciones geométricas, transformaciones de visualización y muchas otras operaciones.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Los nombres de las funciones de la biblioteca básica de OpenGL (también llamada de biblioteca del núcleo&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
de OpenGL) utilizan como prefijo g l , y cada palabra que forma parte del nombre de una función tiene su&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
primera letra en mayúscula. Los siguientes ejemplos ilustran este convenio de denominación.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;glBegin, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;glClear, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; glCopyPixels, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; glPolygonMode&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bueno sin mas que decir empezamos analizando el codigo linea por linea.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;NOTA:&lt;/b&gt;&lt;/span&gt; Todo el codigo es en una sola clase y esta dividido en fragmentos para facilitar el entendimiento.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;//Archivo: Rubik.java
//Autor: Ivan Gallardo
import com.sun.opengl.util.Animator;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;
import javax.swing.JFrame;
import com.sun.opengl.util.GLUT;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureIO;
import java.io.IOException;

public class Rubik extends JFrame implements KeyListener{
    static GL gl;
    static GLU glu;
    static GLUT glut;
    static GLCanvas canvas;
    private static float rotarX=0;
    private static float rotarY=0;
    private static float rotarZ=0;
    private static float trasladaX=0;
    private static float trasladaY=0;
    private static float trasladaZ=0;
    private Texture cara1, cara2,cara3,cara4, cara5,cara6;
    private static float EscaX=1.0f;
    private static float EscaY=1.0f;
    private static float EscaZ=1.0f;
    private static float EscaXm=1.0f;
    private static float EscaYm=1.0f;
    private static float EscaZm=1.0f;
    static float rojo=0.0f;
    static float verde=0.0f;
    static float azul=0.0f;
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bueno de la linea de comando 3 a la 16 son las librerias necesarias para los diferentes metodos que&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt; utilizaremos en nuestro programa que en &lt;i&gt;Netbeans&lt;/i&gt; se originan automaticamente cuando insertamos una sentencia que las necesite asi que con eso no tendremos mayor problema. Bien en nuestra linea 18 esta el nombre de nuestra clase con la extencion de &lt;b&gt;JFrame&lt;/b&gt; para nuestro frame de la clase tenemos implementado &lt;b&gt;KeyListener&lt;/b&gt; para poder utilizar nuestro teclado y asignarle funciones. De la linea 19 a 38 son nuestras variables que ocuparemos en todo nuestro pragrama ya ire mencionando cada una de ellas conforme vayamos haciendo uso de ellas.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public Rubik(){
        setSize(700, 600);
        setTitle(&quot;Cubo De Rubik&quot;);
        setResizable(true);
        GraphicListener listener = new GraphicListener();
        canvas = new GLCanvas();
        gl = canvas.getGL();
        glu = new GLU();
        glut = new GLUT();
        canvas.addGLEventListener(listener);    
        getContentPane().add(canvas);
        Animator animator = new Animator(canvas);
        animator.start();
        addKeyListener(this);
        
    }
&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien continuando con nuestro programa en la siguiente linea creamos nuestro constructor con el nombre de nuestra clase que es como se identifica. en la linea 2 asignamos el tamaño de la ventana donde mostraremos nuestra figura, en la linea 3 el titulo de la ventana en este caso es &quot;Cubo de Rubik&quot;, la sentencia &lt;b&gt;setResizable &lt;/b&gt;puede ser false o true como se muestra en nuestro código y esto sirve para los que no sabemos para maximizar o o minimizar el tamaño de la ventana, en la linea 5 invocamos a la clase &lt;b&gt;GraphicListener&lt;/b&gt;&amp;nbsp;con el nombre listener para inicializar o convocar la clase. En la linea 6 utilizaremos nuestra primer variable asignada en el fragmento anterior (linea 22) que es &lt;b&gt;GLCanvas &lt;/b&gt;&amp;nbsp;con el nombre canvas para poder utilizar todos los métodos que esa clase contiene, para que nos sirve el canvas para visualizar básicamente nuestras figura de OpenGL en una forma animada,de las linea 7 a la 9 Utilizaremos las otras 3 variables de OpenGL donde en la variable gl asignamos la clase canvas con sus métodos, las variables glu y glut son variables que contienen una clase de figuras predefinidas que veremos mas adelante, en las tres ultimas lineas de codigo lo unico que se hace es invocar la clase animator e introducir dentro de ella la clase canvas para dar la animacion y procedemos a darle inicio con star(), la ultima es para nuestro teclado y las teclas que seran asignadas mas adelante con su respectiva función.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void main(String args[]){
        Rubik r = new Rubik();
        r.setVisible(true);
        r.setDefaultCloseOperation(EXIT_ON_CLOSE);
        r.setLocationRelativeTo(null);
    }
&lt;/pre&gt;
&lt;/div&gt;
Se podria decir que es la parte mas importante del programa porque es donde esta nuestro &lt;b&gt;main, &lt;/b&gt;que es el metodo que inicializa a nuestra clase completa y hace que nuestro programa corra.&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class GraphicListener implements GLEventListener{
        public void display(GLAutoDrawable arg0) {
            gl = arg0.getGL();
            gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);                      
            gl.glMatrixMode(GL.GL_PROJECTION);
            gl.glLoadIdentity();
            glu.gluPerspective(50, 2, 0.1, 30);
            gl.glMatrixMode(GL.GL_MODELVIEW);
            gl.glDepthFunc(GL.GL_LEQUAL); 
            gl.glEnable(GL.GL_DEPTH_TEST);
            gl.glClearDepth(1.0);
            gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_DECAL);
            gl.glLoadIdentity();
            glu.gluLookAt(0.1 + trasladaX, .1 + trasladaY, .5 + trasladaZ, 0.5 + trasladaX,0, -5.5 + trasladaZ, 0.0, 1.0, 0.0);
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En esta parte del codigo iniciamos una nueva clase que se llama GraphicListener y le implementamos la libreria de OpenGL con eventos, enseguida creamos un metodo llamado &lt;b&gt;display &lt;/b&gt;que es como su nombre lo dice nos permite mostrar nuestro cubo, en la siguiente linea utilizamos nuestra variable gl y le asignamos el argumento arg0 con la libreria de OpenGL, en las proximas lineas utilizamos las libreria de OpenGL para crear la perspectiva, proyeccion, textura, traslacion y las inicializamos como se muestran.
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;            cara1.enable();
            cara1.bind();
            gl.glScalef(EscaX,EscaY,EscaZ);
            gl.glScalef(EscaXm,EscaYm,EscaZm);
            gl.glRotatef(rotarX, 1f, 1f, 0f);
            gl.glRotatef(rotarY, 0f, 1f, 1f);
            gl.glRotatef(rotarZ, 0f, 0f, 1f);
            gl.glBegin(gl.GL_QUADS);                                            
            gl.glTexCoord2f(1, 1);                
            gl.glVertex3f(0, 0, 0);     
            gl.glTexCoord2f(0, 1);
            gl.glVertex3f(0.2f, 0f, 0);
            gl.glTexCoord2f(0, 0);
            gl.glVertex3f(.2f, .2f, 0);
            gl.glTexCoord2f(1, 0);
            gl.glVertex3f(0f, .2f, 0);
            gl.glEnd();
            cara1.disable();
&lt;/pre&gt;
Atención en esta parte del codigo ya que es una de las partes mas importantes de nuestro programa, bien en la linea 1 utilizamos nuestra primer variable de tipo textura llamada &lt;b&gt;cara1&lt;/b&gt;&amp;nbsp;con el metodo permitir mostrar la primer cara del cubo, en la linea 2 obligamos a nuestro programa a mostrar cara1, de la linea 3 a la 7 utilizimaos las libreria OpenGL de &lt;b&gt;escalacion y rotacion&lt;/b&gt;&amp;nbsp;cada uno de estos metodos tiene tres valores booleano dentro del primer metodo que es el &lt;b&gt;glScalef()&lt;/b&gt;, colocamos nuestras variables de escalacion positivas y en la linea siguiente mismo metodo pero con variables negativas (en la parte de las teclas veran porque positivo(+)&amp;nbsp;y negativo(-)), el metodo &lt;b&gt;glRotatef()&lt;/b&gt;&amp;nbsp;al igual que el glSalef() contiene valores booleanos y en el primero tenemos valores positivos y en el segundo tenemos valores negativos. En la linea de 8 utilizamos la libreria de primitivas de OpenGL del cuadrado para formar nuestra cara principal osea la cara 1, de la linea de codigo 9 a la 16 ponemos la ubicacion de los puntos de coordenadas 3D y los vertices, por ultimo en la 17 y 18 terminamos nuestro muestre de la cara1 y deshabilitamos nuestra cara 1 para poder activar las 5 caras restantes utilizando el mismo codigo.&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public void init(GLAutoDrawable arg0){    
            
            try {               
            cara1 = TextureIO.newTexture(new File(&quot;Rubik.jpg&quot;), true);            
            cara2 = TextureIO.newTexture(new File(&quot;Rubik1.jpg&quot;), true);            
            cara3 = TextureIO.newTexture(new File(&quot;Rubik2.jpg&quot;), true);       
            cara4 = TextureIO.newTexture(new File(&quot;Rubik3.jpg&quot;), true);       
            cara5 = TextureIO.newTexture(new File(&quot;Rubik4.jpg&quot;), true);       
            cara6 = TextureIO.newTexture(new File(&quot;Rubik5.jpg&quot;), true);       
            } catch (IOException e) {
                System.exit(1);
            }
            
        }
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este metodo es donde mandaremos a traer a nuestra textura como podemos observar son 6 caras lo que quiere decir que para cada cara necesitamos una textura y finalizamos con un true para que la muestre.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public void keyPressed(KeyEvent arg0){
       if(arg0.getKeyCode()==KeyEvent.VK_ESCAPE){
            rotarX=0;
            rotarY=0;
            rotarZ=0;
            trasladaX=0;
            trasladaY=0;
            trasladaZ=0;
            EscaX=1.0f;
            EscaY=1.0f;
            EscaZ=1.0f;
            EscaXm=1.0f;
            EscaYm=1.0f;
            EscaZm=1.0f;
            rojo=0.0f;
            verde=0.0f;
            azul=0.0f;
        }
        if(arg0.getKeyCode()==KeyEvent.VK_X){
            rotarX+=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_A){
            rotarX-=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_Y){
            rotarY+=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_B){
            rotarY-=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_Z){
            rotarZ+=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_C){
            rotarZ-=1.0f;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_RIGHT){
            trasladaX+=.10f;
        }

          if(arg0.getKeyCode()==KeyEvent.VK_LEFT){
            trasladaX-=.10f;
        }

         if(arg0.getKeyCode()==KeyEvent.VK_UP){
            trasladaY+=.10f;
        }

          if(arg0.getKeyCode()==KeyEvent.VK_DOWN){
            trasladaY-=.10f;
          }

        if(arg0.getKeyCode()==KeyEvent.VK_1){
            trasladaZ+=.1;
          }

        if(arg0.getKeyCode()==KeyEvent.VK_2){
            trasladaZ-=.10f;
          }
        if(arg0.getKeyCode()==KeyEvent.VK_3){
            rotarY+=1.0;
        }

        if(arg0.getKeyCode()==KeyEvent.VK_4){
            rotarY-=1.0;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_I){
            EscaX +=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_O){
            EscaY +=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_P){
            EscaZ +=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_J){
            EscaXm -=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_K){
            EscaYm -=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_L){
            EscaZm -=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_E){
            rojo +=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_R){
            verde +=0.1f;
        }
        else if (arg0.getKeyCode()== KeyEvent.VK_T){
            azul +=0.1f;
        }
    }

    public void keyReleased(KeyEvent arg0){}
    public void keyTyped(KeyEvent arg0){}
&lt;/pre&gt;
Estamos en la ultima parte de nuestro programa es la parte donde asignamos a cada tecla una funcion o una variable con un valor ya sea en aumento o disminución para darle valores a los metodos donde fueron colocadas la unica q sirve con un reset es la tecla escape que esa es restaurar todos los valores de las variables como estaban al inicio.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Bueno sin mas que decir aqui esta una imagen de nuestro cubo y mas abajo el codigo java del programa espero y les haya servido suerte.&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3zw9XLMw3cwInqpfqwxD10hGIKgOMwUTYk4Lq881Fc6AgsASJ4AX2GDkomSvXPpIsKRLktXqCnByVRLz3kF_rPiVGxGV6eEUjYYdv2ujeYv4RNy8i4dRsKxBFOlWfOjlHfDP1wj__l3xH/s1600/Sin+t%C3%ADtulo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;211&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3zw9XLMw3cwInqpfqwxD10hGIKgOMwUTYk4Lq881Fc6AgsASJ4AX2GDkomSvXPpIsKRLktXqCnByVRLz3kF_rPiVGxGV6eEUjYYdv2ujeYv4RNy8i4dRsKxBFOlWfOjlHfDP1wj__l3xH/s400/Sin+t%C3%ADtulo.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Descarga el&amp;nbsp;código&amp;nbsp;aquí:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;https://sites.google.com/site/anibalclavel/home/CuboRubik.java.java?attredirects=0&amp;amp;d=1&quot;&gt;CuboRubik.java&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/5211288382698099286/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/cubo-de-rubik-en-java.html#comment-form' title='4 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/5211288382698099286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/5211288382698099286'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/cubo-de-rubik-en-java.html' title='Cubo de Rubik en JAVA'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03054566529239841799</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3zw9XLMw3cwInqpfqwxD10hGIKgOMwUTYk4Lq881Fc6AgsASJ4AX2GDkomSvXPpIsKRLktXqCnByVRLz3kF_rPiVGxGV6eEUjYYdv2ujeYv4RNy8i4dRsKxBFOlWfOjlHfDP1wj__l3xH/s72-c/Sin+t%C3%ADtulo.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-8743076095908320994</id><published>2013-06-11T01:01:00.000-05:00</published><updated>2013-06-11T01:01:25.976-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Concatenar cadenas</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
En java para se puede hacer de dos formas, utilizando el método &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;concat&lt;/span&gt;&lt;/b&gt; o con el operador&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;+&lt;/b&gt;&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para dar una idea mas clara hemos realizado este pequeño programa:&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * @Archivo: Cadenas.java
 * @author Cerecero 
 * @since 11/junio/2013
 */
public class Cadenas 
{
  public static void main(String[] args) 
  {
    String cadena1 = &quot;Bienvenido a &quot;;
    String cadena2 = &quot;Buenas Intenciones&quot;;
        
    String cadena3 = cadena1.concat(cadena2);
    String cadena4 = cadena1 + cadena2;
        
    System.out.println(cadena3);
    System.out.println(cadena4);
  }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 11 y 12 hemos declarado e inicializado dos variables de tipo String, en la linea 14 usaremos el método &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;concat&lt;/span&gt;&lt;/b&gt;, para concatenar (unir) la &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena1&lt;/b&gt;&lt;/span&gt; y &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena2&lt;/b&gt;&lt;/span&gt;, como se puede observar para hacer esto, se declaro una tercera variable (&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena3&lt;/b&gt;&lt;/span&gt;), en donde se guardara la nueva String, en otras palabras, lo que estamos diciendo en esta linea es: A &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena3&lt;/b&gt;&lt;/span&gt; le vas a asignar la &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena1&lt;/b&gt;&lt;/span&gt; concatenada con la &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;cadena2&lt;/b&gt;&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 15 estamos haciendo lo mismo, solo que en vez de usar el método concat, estamos usando el signo&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;+&lt;/b&gt;&lt;/span&gt;. El resultado es el siguiente:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzs-WlIvd8MUrun_8JH2Kpu5lC0QBsLsruXfOjjPLXg9u_4ZOBZSe3vGiolu8by2MYKnlHNt24qF3TxNWivpXyzmHpWMSCPjENwnwggEHpxy6Fg5XUh8AryoGDa3LRSXoKZ3GkOpy1mHcD/s1600/Captura+de+pantalla+de+2013-06-11+00:57:22.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzs-WlIvd8MUrun_8JH2Kpu5lC0QBsLsruXfOjjPLXg9u_4ZOBZSe3vGiolu8by2MYKnlHNt24qF3TxNWivpXyzmHpWMSCPjENwnwggEHpxy6Fg5XUh8AryoGDa3LRSXoKZ3GkOpy1mHcD/s320/Captura+de+pantalla+de+2013-06-11+00:57:22.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/8743076095908320994/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/concatenar-cadenas.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8743076095908320994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8743076095908320994'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/06/concatenar-cadenas.html' title='Concatenar cadenas'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzs-WlIvd8MUrun_8JH2Kpu5lC0QBsLsruXfOjjPLXg9u_4ZOBZSe3vGiolu8by2MYKnlHNt24qF3TxNWivpXyzmHpWMSCPjENwnwggEHpxy6Fg5XUh8AryoGDa3LRSXoKZ3GkOpy1mHcD/s72-c/Captura+de+pantalla+de+2013-06-11+00:57:22.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-51115443946306526</id><published>2013-05-14T19:57:00.000-05:00</published><updated>2013-05-15T16:02:46.813-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Básico"/><title type='text'>Instalación de Java en Ubuntu</title><content type='html'>Para instalar java en ubuntu existen diferentes métodos, pero la manera mas&amp;nbsp;fácil&amp;nbsp;y sencilla, es usando la terminal. Lo&amp;nbsp;único&amp;nbsp;que necesitamos hacer es lo siguiente:&lt;br /&gt;
&lt;br /&gt;
1.- Abrimos una terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrhl0G1kRYZXgDELoh5lERBIqnPkSXFlKqJ1RbNonBuOO0VKmlszvriD6uDOQ4_OewEPnwkk8DBCLNpYIT2pgHubQF78ZLmX30-yTEz4t9KJ0_4biBzmYs0ywZ9-YfwcZmdLZdeXmVODQx/s1600/Captura+de+pantalla+de+2013-05-14+19:20:09.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrhl0G1kRYZXgDELoh5lERBIqnPkSXFlKqJ1RbNonBuOO0VKmlszvriD6uDOQ4_OewEPnwkk8DBCLNpYIT2pgHubQF78ZLmX30-yTEz4t9KJ0_4biBzmYs0ywZ9-YfwcZmdLZdeXmVODQx/s400/Captura+de+pantalla+de+2013-05-14+19:20:09.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
2.- Actualizamos repositorios con &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;sudo apt-get update&lt;/b&gt;&lt;/span&gt;&amp;nbsp;y presionamos enter.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj385PUqTq-vBul9ZyiL1dRRY3VZ7N8OniC_3usAdNa2KRlQRcKSq_obVCW_m5W_qyDil5zkiYsJJRRiotzHifoFM7zSZ3g6_uAqyLdQ201IrJ4MBYhjxMWASgAvivvU81wMcuDHJCz10M/s1600/Sin+nombre.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;268&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj385PUqTq-vBul9ZyiL1dRRY3VZ7N8OniC_3usAdNa2KRlQRcKSq_obVCW_m5W_qyDil5zkiYsJJRRiotzHifoFM7zSZ3g6_uAqyLdQ201IrJ4MBYhjxMWASgAvivvU81wMcuDHJCz10M/s400/Sin+nombre.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
3.- Escribimos &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;sudo apt-get install openjdk-7-jre&lt;/b&gt;&lt;/span&gt; y presionamos enter.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjtvh8ecj-Ey-WuViuOodFZOglvsQrT24_xX10pStdosTBG-9NV49FsuYXOSG11dcoSfgpnz0xAeVsw6G6rFjczL4jmn5XtgsCaypxXt16M-VdZPHrr51h99t95oZTQAkKflTzTg76rrmh/s1600/Sin+nombre.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;268&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjtvh8ecj-Ey-WuViuOodFZOglvsQrT24_xX10pStdosTBG-9NV49FsuYXOSG11dcoSfgpnz0xAeVsw6G6rFjczL4jmn5XtgsCaypxXt16M-VdZPHrr51h99t95oZTQAkKflTzTg76rrmh/s400/Sin+nombre.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
4.- Nos preguntara ¿Desea continuar [s/n]? Para instalar colamos una &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;s&lt;/b&gt;&lt;/span&gt; y para cancelar una &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;n&lt;/b&gt;&lt;/span&gt;,&amp;nbsp;después&amp;nbsp;presionamos enter.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2_fYxmokTEuY80BZt_Ky2muIBUkfnkkXIQ3RAdCSF_QnVbLrHE9B9gSFdlcxTh93ytUDw7rh0FfXbgF7PnA9b5J9GDDJ1-ibwhNiMMqad98frSrOqKnuoc-Zc-vKkOVD8Ox5_v1ru6R2J/s1600/Sin+nombre.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2_fYxmokTEuY80BZt_Ky2muIBUkfnkkXIQ3RAdCSF_QnVbLrHE9B9gSFdlcxTh93ytUDw7rh0FfXbgF7PnA9b5J9GDDJ1-ibwhNiMMqad98frSrOqKnuoc-Zc-vKkOVD8Ox5_v1ru6R2J/s400/Sin+nombre.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Esperamos a que haga la descarga y&amp;nbsp;después&amp;nbsp;realice la instalación...&lt;br /&gt;
&lt;br /&gt;
5.- Escribimos&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;sudo apt-get install openjdk-7-jdk&lt;/b&gt;&lt;/span&gt;&amp;nbsp;y presionamos enter.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFwTWz40XooHFdQSd2SsSzVOy95cxAy40GnEBqdi5LtT7yMk5dPOgLlnkFtdWsLqVNco6nv5i2eOEQxe0_pSLJfYS4QG2VBkjE_xfUSpOdgUVLm9frcFBVGNWgMP6SGIjjzLBNH1hXI4gj/s1600/ubuntumetal_cof.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFwTWz40XooHFdQSd2SsSzVOy95cxAy40GnEBqdi5LtT7yMk5dPOgLlnkFtdWsLqVNco6nv5i2eOEQxe0_pSLJfYS4QG2VBkjE_xfUSpOdgUVLm9frcFBVGNWgMP6SGIjjzLBNH1hXI4gj/s400/ubuntumetal_cof.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
El paso 4 se repite de nuevo.&lt;br /&gt;
&lt;br /&gt;
6.- Para comprobar que todo se ha instalado correctamente escribiremos&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;java -version&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgavCqk9KNbKXTNhVjHfD_WRCuRu0CJcbuLu85ITzRg0NTk04eK0_N8WjXN08nPjk4V5lunkQiDu6pNEyZ7HCyqAWhWhgG9BWSai1_pQ93Wfs88BeKWcrEh1x8AOBg0Fy-rnArCr6mGxXaY/s1600/Captura+de+pantalla+de+2013-05-14+19:51:33.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;268&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgavCqk9KNbKXTNhVjHfD_WRCuRu0CJcbuLu85ITzRg0NTk04eK0_N8WjXN08nPjk4V5lunkQiDu6pNEyZ7HCyqAWhWhgG9BWSai1_pQ93Wfs88BeKWcrEh1x8AOBg0Fy-rnArCr6mGxXaY/s400/Captura+de+pantalla+de+2013-05-14+19:51:33.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
El resultado debe ser el siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFtREGgvgxJbK2nb8ihX2kB6pdOsHTpd39gjt0ivqfDwYvWJq72o30_W3DhYxG28s-FjGEJC6WKszeNaD3c4gQ6MDZVqsg5nibEYlRsWlZNr5R983bPEXKM1WmVrXGLWrVTj4dbKZ18r8M/s1600/Captura+de+pantalla+de+2013-05-14+19:51:53.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;265&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFtREGgvgxJbK2nb8ihX2kB6pdOsHTpd39gjt0ivqfDwYvWJq72o30_W3DhYxG28s-FjGEJC6WKszeNaD3c4gQ6MDZVqsg5nibEYlRsWlZNr5R983bPEXKM1WmVrXGLWrVTj4dbKZ18r8M/s400/Captura+de+pantalla+de+2013-05-14+19:51:53.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Y eso es todo, ahora ya esta instalado Java.</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/51115443946306526/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/05/instalacion-de-java-en-ubuntu.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/51115443946306526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/51115443946306526'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/05/instalacion-de-java-en-ubuntu.html' title='Instalación de Java en Ubuntu'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrhl0G1kRYZXgDELoh5lERBIqnPkSXFlKqJ1RbNonBuOO0VKmlszvriD6uDOQ4_OewEPnwkk8DBCLNpYIT2pgHubQF78ZLmX30-yTEz4t9KJ0_4biBzmYs0ywZ9-YfwcZmdLZdeXmVODQx/s72-c/Captura+de+pantalla+de+2013-05-14+19:20:09.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-8271775350463497264</id><published>2013-04-26T00:25:00.001-05:00</published><updated>2013-04-26T00:27:09.017-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Estructuras de Datos"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><title type='text'>Pilas (Stack)</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;text-align: justify;&quot;&gt;Una pila o stack es una lista de elementos a la cual se le
pueden insertar o extraer elementos solo por uno de sus extremos. Las pilas son
estructuras de datos en las que la inserción de datos se hace por el frente y
la eliminación de los datos de igual manera se hace por el frente, se elimina
un dato por el mismo lado de donde se inserta; debido a esta característica de inserción
y eliminación de datos también se le conoce como estructura &lt;/span&gt;&lt;b style=&quot;text-align: justify;&quot;&gt;LIFO&lt;/b&gt;&lt;span style=&quot;text-align: justify;&quot;&gt; (&lt;/span&gt;&lt;i style=&quot;text-align: justify;&quot;&gt;Last-In,
First-Out&lt;/i&gt;&lt;span style=&quot;text-align: justify;&quot;&gt;: Ultimo en entrar, primero en salir).&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Una representación&amp;nbsp;analógica&amp;nbsp;de una pila con objetos cotidianos,&amp;nbsp;podría&amp;nbsp;ser una pila de platos: En una mesa se colocan muchos platos uno encima del otro (una pila de platos), para colocar un nuevo plato en la pila se coloca el plato en la cima de la pila. Para sacar un plato de la pila es necesario sacar el plato que esta encima de la pila (el ultimo plato que fue colocado en la pila de platos).&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlnrYz9SDOnaNQDbnxj33MtsPiivymn0SwdWdJaZJZpsWhiim2HAJEvAwnkJTWjmaOdB0dQ_tVsyzBEOkB-Z72AKMX2G54656JQHlDFKxhNLTwMb89KOV3MNqm1ZFnNcWmj74_OUnCK4wR/s1600/Pila.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlnrYz9SDOnaNQDbnxj33MtsPiivymn0SwdWdJaZJZpsWhiim2HAJEvAwnkJTWjmaOdB0dQ_tVsyzBEOkB-Z72AKMX2G54656JQHlDFKxhNLTwMb89KOV3MNqm1ZFnNcWmj74_OUnCK4wR/s400/Pila.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;(a) Una pila de libros. (b) Una pila de CD&#39;s. (c) Una pila de platos.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Al igual que en en la&amp;nbsp;analogía&amp;nbsp;de la pila de platos, en las pilas de datos la&amp;nbsp;información&amp;nbsp;se almacena de la misma manera y se inserta nueva&amp;nbsp;información&amp;nbsp;y se elimina un dato del mismo modo. Ahora, para comodidad del lector vamos a representar una pila de datos de la siguiente manera:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZcUdyGgs48rAACakR814ERoMhvCNtWzYVR6WTpyt5AcGpnMxe2fhha6jb8ZvcpWuDhCECnJaQ47cuPiOIyOHeoxIKlb1fCTXPVaRHQ-iffcmB3Vef2abvJo2BZaCzBSnS4_Vosp3iF3M7/s1600/Pila.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;312&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZcUdyGgs48rAACakR814ERoMhvCNtWzYVR6WTpyt5AcGpnMxe2fhha6jb8ZvcpWuDhCECnJaQ47cuPiOIyOHeoxIKlb1fCTXPVaRHQ-iffcmB3Vef2abvJo2BZaCzBSnS4_Vosp3iF3M7/s400/Pila.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
En la figura&amp;nbsp;anterior&amp;nbsp;podemos observar una pila de datos con 4 elementos apilados.&amp;nbsp;Podrían&amp;nbsp;ser 4 elementos de cualquier tipo, hablando de&amp;nbsp;programación&amp;nbsp;en Java&amp;nbsp;podrían&amp;nbsp;ser: &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;string&lt;/span&gt; o incluso objetos.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Las pilas son estructuras de datos generalmente&amp;nbsp;&lt;b&gt;estáticas&lt;/b&gt;&amp;nbsp; ya que regularmente se crean usando la implementación de arreglos, y como se sabe: su tamaño no puede crecer en memoria en tiempo de&amp;nbsp;ejecución&amp;nbsp; es decir, debemos establecer un tamaño&amp;nbsp;fijo&amp;nbsp;de elementos que se guardaran en la pila. Las Stack tienen 2 operaciones&amp;nbsp;básicas: &lt;b&gt;push&lt;/b&gt; (apilar, insertar) y &lt;b&gt;pop&lt;/b&gt; (desapilar o eliminar), aunque se puede implementar más&amp;nbsp;métodos&amp;nbsp;a una pila para obtener alguna otra&amp;nbsp;información&amp;nbsp;que se requiera.&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: purple; font-size: x-large;&quot;&gt;&lt;b&gt;➮ Pila&amp;nbsp;vacía&amp;nbsp;y llena.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la siguiente figura se representan 2 pilas de tamaño de 5 elementos: la primera pila esta&amp;nbsp;vacía&amp;nbsp;(&lt;i&gt;Empty Stack&lt;/i&gt;) y la segunda pila esta llena (&lt;i&gt;Full Stack&lt;/i&gt;).&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDxplW8r_k5jv8yAj_kFzHkIlXv2EcRN-b_oZ0_H4YWqK_R_vGr94_qVuQ0TEzO4OQVpCV_fcIUbFwsAFFtBC3Flh0hxNfNnBl8U_F_I6qahKonLqrF3xQ3BQ5JfK6PKP0UFkPNxDnGOK5/s1600/Vacia+y+llena.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;312&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDxplW8r_k5jv8yAj_kFzHkIlXv2EcRN-b_oZ0_H4YWqK_R_vGr94_qVuQ0TEzO4OQVpCV_fcIUbFwsAFFtBC3Flh0hxNfNnBl8U_F_I6qahKonLqrF3xQ3BQ5JfK6PKP0UFkPNxDnGOK5/s400/Vacia+y+llena.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la figura anterior se representa una pila&amp;nbsp;vacía&amp;nbsp; cuando no tiene&amp;nbsp;ningún&amp;nbsp;elemento insertado; y la pila llena cuando tiene la capacidad&amp;nbsp;máxima&amp;nbsp;de elementos que le hemos asignado para insertar. La pila&amp;nbsp;vacía&amp;nbsp; no tiene&amp;nbsp;ningún&amp;nbsp;elemento, sin embargo tiene espacio para almacenar 5 elementos como&amp;nbsp;máximo, como no tiene&amp;nbsp;ningún&amp;nbsp;elemento insertado no es posible eliminar&amp;nbsp;algún&amp;nbsp;elemento de la pila, sin embargo en Java si se intentara eliminar&amp;nbsp;algún&amp;nbsp;elemento de una pila&amp;nbsp;vacía&amp;nbsp;generaría&amp;nbsp;un error de &lt;b&gt;subdesordenamiento&lt;/b&gt;;&amp;nbsp; mientras la pila llena tiene espacio para almacenar 5 elementos, los cuales ya&amp;nbsp;están&amp;nbsp;insertados en la pila y ya no puede insertarse&amp;nbsp;ningún&amp;nbsp;elemento más; en Java si se intentara insertar otro elemento más a la pila&amp;nbsp;arrojaría&amp;nbsp;un error de &lt;b&gt;desbordamiento&lt;/b&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;color: purple;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;➮ El tope de la pila.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El tope de la pila es el elemento que se encuentra en la cima de la pila.&amp;nbsp;Aquí&amp;nbsp;se representan 4 pilas con sus respectivos topes en diferente&amp;nbsp;posición&amp;nbsp;cada uno:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvxrSqlCaKZvgMerZbNuqeuHtb8DNZ-j1w3W81GRrlI_jCxij9QCZZ_Tk8KcVNZ2_roEgSMp2fRldXHhUH4eHndKZ0_EpMeUiZhNuWOzs60n_dsCYiamEXLMXMFoFCvGGTc866CIJw43vt/s1600/Tope.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvxrSqlCaKZvgMerZbNuqeuHtb8DNZ-j1w3W81GRrlI_jCxij9QCZZ_Tk8KcVNZ2_roEgSMp2fRldXHhUH4eHndKZ0_EpMeUiZhNuWOzs60n_dsCYiamEXLMXMFoFCvGGTc866CIJw43vt/s400/Tope.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Cuando se crea una pila por medio de arreglos es importante recalcar que tiene las&amp;nbsp;características&amp;nbsp;del arreglo mismo (Un arreglo tiene un nombre propio y para acceder a cada uno de sus datos es necesario hacer&amp;nbsp;mención&amp;nbsp;del nombre de arreglo y del&amp;nbsp;subíndice&amp;nbsp;[posición] donde esta el dato que queremos obtener).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para obtener&amp;nbsp;información&amp;nbsp;sobres el tope de una pila solo se tiene que escribir una&amp;nbsp;instrucción&amp;nbsp;donde hagamos referencia al nombre del arreglo y el&amp;nbsp;subíndice&amp;nbsp;que contenga el ultimo elemento insertado en la pila.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Por ejemplo, para la Pila A el tope es -1 debido a que es una pila&amp;nbsp;vacía&amp;nbsp;y no contiene&amp;nbsp;ningún&amp;nbsp;elemento insertado. En la Pila B el tope esta en el subíndice 2 y contiene el elemento [3 verde]. En la Stack C el tope esta situado en el&amp;nbsp;subíndice&amp;nbsp;4 que contiene al elemento [5 rojo] y es el tamaño máximo de la pila. En la Pila D el tope esta en la&amp;nbsp;posición&amp;nbsp;0 y contiene [1 Lila].&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;color: purple;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;➮ Push &amp;amp; Pop.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Las operaciones básicas de la pila son: insertar un elemento (push) y quitar un elemento (pop).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: red;&quot;&gt;PUSH&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;: cuando se ejecuta la&amp;nbsp;instrucción&amp;nbsp;&lt;i&gt;Push&lt;/i&gt; en una Pila, se ejecuta un algoritmo que inserta un elemento dentro de la pila de datos. Suponga que queremos insertar el numero 5 en una pila de&amp;nbsp;números:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPcrm3sXFTDV4NUhv1btge7ZvZad1gJulWhMDsRDhSUxG8_uUMImjbNviVmVmFiTKVl8kn0iXDC6mHvURnHw0mH3aVN11bJl7aBTZ4aJKAqntC2wdTjjV3akQPTKoKG8NiBeCxnHcI75sR/s1600/PUSH.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPcrm3sXFTDV4NUhv1btge7ZvZad1gJulWhMDsRDhSUxG8_uUMImjbNviVmVmFiTKVl8kn0iXDC6mHvURnHw0mH3aVN11bJl7aBTZ4aJKAqntC2wdTjjV3akQPTKoKG8NiBeCxnHcI75sR/s320/PUSH.jpg&quot; width=&quot;267&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la imagen anterior hay una pila de&amp;nbsp;números&amp;nbsp;de tamaño 5 (osea que se pueden insertar hasta 5&amp;nbsp;números). En la pila solo existen 4&amp;nbsp;números&amp;nbsp;insertados (1,2,3 y 4) que ocupan desde la&amp;nbsp;posición&amp;nbsp;0 hasta la&amp;nbsp;posición&amp;nbsp;3 de la pila. Cuando ejecutamos la&amp;nbsp;instrucción&amp;nbsp; &lt;b&gt;&lt;i&gt;Push(5);&lt;/i&gt;&lt;/b&gt; indicamos que se va a inserta el numero 5 en nuestra pila, de este modo el numero 5 que sera insertado quedara ocupando la&amp;nbsp;posición&amp;nbsp;4 de nuestra pila.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: red;&quot;&gt;POP:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt; cuando se ejecuta la&amp;nbsp;instrucción&amp;nbsp;&lt;i&gt;Pop&lt;/i&gt; en una pila se esta indicando que queremos borrar el elemento que se encuentre en la cima de nuestra pila:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtQXrCxspYg7pjNemjybZdf5MpYApTzvjlDBBZbDk5no1dOkeyU9AAiYDLtMIC8MUgJO-sKmnaoRNI2F4Ikhe9uZQOQWBAlp-Pa7LnqFO8AFDg23Bh4fXYGsBZvPFFokgfkhbOQSjpwbY4/s1600/POP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtQXrCxspYg7pjNemjybZdf5MpYApTzvjlDBBZbDk5no1dOkeyU9AAiYDLtMIC8MUgJO-sKmnaoRNI2F4Ikhe9uZQOQWBAlp-Pa7LnqFO8AFDg23Bh4fXYGsBZvPFFokgfkhbOQSjpwbY4/s320/POP.jpg&quot; width=&quot;270&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para este ejemplo se tiene una pila con 5 elementos insertados (1,2,3,4 y 5), estos van desde la&amp;nbsp;posición&amp;nbsp;0 hasta la&amp;nbsp;posición&amp;nbsp;4; Cuando indicamos una&amp;nbsp;instrucción&amp;nbsp;&lt;b&gt;&lt;i&gt;Pop()&lt;/i&gt;&lt;/b&gt; se elimina el ultimo elemento insertado (el elemento de la cima de la pila), de este modo el ultimo elemento insertado en la pila (el numero 5, en la&amp;nbsp;posición&amp;nbsp;4) se elimina de la pila.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;color: purple;&quot;&gt;➮ Hagamos&amp;nbsp;código.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este programa esta orientado a objetos y cuenta con 2 clases: La clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt; y la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Principal&lt;/span&gt;. Es necesario mencionar que en esta&amp;nbsp;ocasión&amp;nbsp;programaremos una pila tradicional, una pila en su modo mas sencillo que solo insertara y eliminara datos en la pila; En la clase pila declararemos los atributos que contiene una pila y programaremos sus&amp;nbsp;métodos&amp;nbsp;a utilizar (push y pop); mientras que en la clase principal crearemos objetos de la clase pila y crearemos una sencilla interfaz en consola para poder utilizar la pila.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;La clase Pila:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Primero creamos la clase Pila, que&amp;nbsp;contendrá&amp;nbsp;como atributos: &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;u&gt;MAXIMO&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;: que es un numero entero el cual indica el tamaño de la pila (para este caso le asignaremos: 5); &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;u&gt;stack&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;: sera un arreglo de enteros donde se&amp;nbsp;almacenaran&amp;nbsp;los elementos de la pila; y &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;u&gt;tope&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;: que sera nuestro apuntador para saber cuando la pila esta llena o&amp;nbsp;vacía&amp;nbsp;o en que espacio del arreglo insertar un elemento, este&amp;nbsp;deberá&amp;nbsp;ser de tipo entero, a &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; lo inicializaremos en -1, debido a que cuando iniciemos la pila esta sera&amp;nbsp;vacía.&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: Pila.java
 * @author Anibal Clavel
 * www.buenasintencions.blogspot.mx
 */

//Inicia la clase pila.
public class Pila {
    
    //Declaracion de atributos a utilizar.
    private final int MAXIMO = 5;
    private int stack[];
    private int tope;
    
    //Constructor.
    public Pila(){
        stack = new int[MAXIMO];
        tope = -1;
    } //Fin del constructor.
    
    //Metodo para insertar.
    public void push(int numero){
        if(tope &amp;lt; MAXIMO-1){
            ++tope;
            stack[tope] = numero;
        }
        else
            System.out.println(&quot;Desbordamiento&quot;);
    } //Fin de Push.
    
    //Metodo para eliminar.
    public void pop(){
        if(tope &amp;gt;= 0)
            tope = tope-1;
        else
            System.out.println(&quot;Subdesordenamiento&quot;);
    } //Fin de Pop.
} //Fin de la clase Pila.
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Analicemos nuestra clase Pila: De la linea 11 a la 13 se&amp;nbsp;están&amp;nbsp;declarando los atributos tal como lo mencionamos anteriormente. Posterior a eso armaremos nuestros&amp;nbsp;métodos&amp;nbsp; que son solo 2 (push y pop), de tal modo que podamos realizar las operaciones de la pila con estos.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Constructor:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 16 iniciamos la&amp;nbsp;codificación&amp;nbsp;de nuestro constructor el cual de primer tarea inicializa nuestro arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt; y le asigna de tamaño lo que contiene &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MAXIMO&lt;/span&gt;, en otras palabras: se crea un arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt; de tamaño 5.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Push:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, pasemos a nuestro&amp;nbsp;método&amp;nbsp;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt;&lt;/b&gt; para insertar un elemento en la pila, iniciamos en la linea 22, donde establecemos que es un&amp;nbsp;método&amp;nbsp;publico con &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;public&lt;/span&gt;,&amp;nbsp;después&amp;nbsp;con &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;void&lt;/span&gt; indicamos que es un&amp;nbsp;método&amp;nbsp;que no retorna nada, &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt; es el nombre del&amp;nbsp;método,&amp;nbsp; &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;(int numero)&lt;/span&gt; es una variable que declaramos para ese&amp;nbsp;método&amp;nbsp;y que nos sirve como un&amp;nbsp;parámetro&amp;nbsp;de entrada (el dato que se insertara).&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 23 iniciando el cuerpo del&amp;nbsp;método (lo que el&amp;nbsp;método&amp;nbsp;realiza), hacemos una&amp;nbsp;validación&amp;nbsp;con un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt; para verificar si &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; es menor que &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MAXIMO-1&lt;/span&gt;; recordemos que &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; es un apuntador del arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt;, &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; indica la&amp;nbsp;posición&amp;nbsp;o&amp;nbsp;subíndice&amp;nbsp;donde nos encontramos situados en el arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt;. &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MAXIMO&lt;/span&gt; es el tamaño de nuestro arreglo y este valor es 5 (para este ejemplo), entonces, al indicar &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MAXIMO-1&lt;/span&gt; lo que hacemos realmente es indicar 5-1, esto resulta 4, ya que 4 es el ultimo&amp;nbsp;subíndice&amp;nbsp;de el arreglo stack. Entonces el algoritmo&amp;nbsp;evalúa&amp;nbsp;y si la&amp;nbsp;condición&amp;nbsp;resulta &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;true &lt;/span&gt;entonces deducimos que el arreglo (la pila) tiene espacio e inserta el elemento que le proporcionemos. Para cuando sea la primera&amp;nbsp;inserción&amp;nbsp;de datos la pila&amp;nbsp;estará&amp;nbsp;vacía&amp;nbsp;y el &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; sera igual a -1, en la linea 24 &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; hace un&amp;nbsp;pre incremento&amp;nbsp;de tal modo que &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; obtenga el valor de 0. En la linea 25 insertamos en el arreglo en la&amp;nbsp;posición&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; (para entonces &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; ya vale 0) ya que esta el la primera&amp;nbsp;posición&amp;nbsp;dentro de nuestro arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt;; para simplificar la linea 25 decimos que el elemento (el&amp;nbsp;parámetro&amp;nbsp;del&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt;) es insertado en el arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt; en la&amp;nbsp;posición&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Cuando ya haya un elemento insertado se realiza la misma&amp;nbsp;validación&amp;nbsp;con &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt;: &lt;i&gt;&quot;¿tope es menor que MAXIMO-1?&quot;&lt;/i&gt; y arrojara un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;true&lt;/span&gt;, entonces se ejecutara nuevamente la linea 24 haciendo un pre incremento a &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; y entonces &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; ya valdrá 1 y en esa&amp;nbsp;posición&amp;nbsp;del arreglo se insertara el nuevo elemento, y&amp;nbsp;así&amp;nbsp;sucederá&amp;nbsp;hasta que la pila este llena.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si la&amp;nbsp;validación&amp;nbsp;con el &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt; en la linea 23 resulta &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;false&lt;/span&gt;, esto significara que tope ya&amp;nbsp;tendrá&amp;nbsp;el valor de 4 (cuatro es la ultima&amp;nbsp;posición&amp;nbsp;de nuestro arreglo stack) por tal motivo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; no sera menor que &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MAXIMO-1&lt;/span&gt;, entonces el&amp;nbsp;método&amp;nbsp;solo mandara un mensaje que indique que hay un desbordamiento porque la pila esta llena y ya no se pueden insertar mas elementos.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Pop:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para el&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pop&lt;/span&gt; que inicia en la linea 32, es un&amp;nbsp;método&amp;nbsp;publico que no retornará&amp;nbsp;ningún&amp;nbsp;valor,&amp;nbsp;también&amp;nbsp;es un&amp;nbsp;método&amp;nbsp;que no recibe&amp;nbsp;ningún&amp;nbsp;parámetro, debido a que no insertara nada y no necesitara&amp;nbsp;ningún&amp;nbsp;valor porque solo eliminará un dato de la pila. Ya en la linea 33 realizamos una&amp;nbsp;validación&amp;nbsp;con &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt; para saber si la pila contiene elementos o esta&amp;nbsp;vacía, de este modo la&amp;nbsp;función&amp;nbsp;del &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt; es preguntar: &lt;i&gt;&quot;¿tope es mayor igual que 0?&quot;&lt;/i&gt;, si la respuesta es un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;true&lt;/span&gt; significara que la pila contiene elementos debido a que &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; que es el apuntador del indice donde nos encontramos situados en nuestro arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt; es mayor o igual a 0 y la&amp;nbsp;posición&amp;nbsp;del arreglo sera valida,&amp;nbsp;así&amp;nbsp;que se pasara a la linea 34 donde a &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; se le asignara el valor que tenga&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; tope &lt;/span&gt;en ese momento menos 1 (&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope-1&lt;/span&gt;). De este modo se hace una re-asignación del apuntador &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;Ejemplo: si en la pila tenemos insertados 3 elementos,&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; contendrá el valor de 2 que es el&amp;nbsp;subíndice&amp;nbsp;del arreglo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;stack&lt;/span&gt; donde estamos posicionados, cuando hagamos &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pop&lt;/span&gt;, a &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; se le resta 1, de tal modo que&amp;nbsp;después&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; valdrá 1 y en ese&amp;nbsp;subíndice&amp;nbsp;del arreglo estaremos ubicados ahora, para cuando se haga un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt; con base en su algoritmo: &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; incrementara en uno y&amp;nbsp;volverá&amp;nbsp;a tener el valor de 2 y en ese&amp;nbsp;subíndice&amp;nbsp;del arreglo se posicionara y&amp;nbsp;sobrescribirá&amp;nbsp;el nuevo valor en esa&amp;nbsp;posición&amp;nbsp; de tal modo que borra el valor contenido&amp;nbsp;ahí&amp;nbsp;y escribe el nuevo valor a insertar&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si en la linea 33 la&amp;nbsp;validación&amp;nbsp;del &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if&lt;/span&gt; arroja un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;false&lt;/span&gt; entonces entenderemos que el valor de &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt; es menor a 0 y &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tope&lt;/span&gt;&amp;nbsp;tendrá&amp;nbsp;el valor de &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-1&lt;/span&gt;, esto&amp;nbsp;querrá&amp;nbsp;decir que la pila esta&amp;nbsp;vacía&amp;nbsp;y que no hay datos para borrar, de tal modo que el&amp;nbsp;método&amp;nbsp;enviara un mensaje que informe que la pila esta&amp;nbsp;vacía&amp;nbsp;y que hay un error de subdesordenamiento.&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;La clase Principal:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, una vez terminado la clase Pila, crearemos objetos de dicha clase en nuestra clase principal para hacer uso de sus&amp;nbsp;métodos&amp;nbsp;y&amp;nbsp;así&amp;nbsp;manipular una pila.&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: Principal.java
 * @author Anibal Clavel
 * www.buenasintencions.blogspot.mx
 */

import java.util.Scanner;

public class Principal {
    
    public static void main (String args[]){
        
        Pila pila = new Pila();
        Scanner scanner = new Scanner(System.in);
        String respuesta = &quot;Si&quot;;
        int valor = 0;
        
        System.out.println(&quot;*** Bienvenido al programa Pila ***&quot;
                + &quot;\n\npila de enteros, tamaño: 5...\n&quot;
                + &quot;se ha creado la pila.\n&quot;);
        
        while(respuesta.equalsIgnoreCase(&quot;Si&quot;)){
            
            System.out.println(&quot;¿Que Operacion desea realizar?&quot;
                    + &quot;\n1. Push.\n2. Pop.\n&quot;);
            valor = scanner.nextInt();
            
            switch(valor){
                case 1:
                    System.out.println(&quot;Selecciono: Push&quot;);
                    System.out.println(&quot;Ingrese un numero a insertar: &quot;);
                    valor = scanner.nextInt();
                    pila.push(valor);
                    System.out.println();
                break;
                case 2:
                    System.out.println(&quot;Selecciono: Pop&quot;);
                    pila.pop();
                    System.out.println();
                break;
                default:
                    System.out.println(&quot;Opcion no valida&quot;);
                    System.out.println();
            }
            
            System.out.println(&quot;¿Desea continuar?&quot;
                    + &quot;\nEscriba &amp;lt;&amp;lt; si &amp;gt;&amp;gt; para continuar&quot;
                    + &quot;\nEscriba &amp;lt;&amp;lt; no &amp;gt;&amp;gt; para salir&quot;);
            respuesta = scanner.next();
            System.out.println();
        }
    }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este es un programa que contiene un&amp;nbsp;menú&amp;nbsp;con algunos adornos, usando un ciclo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while&lt;/span&gt;, un &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;switch&lt;/span&gt;,&amp;nbsp;métodos&amp;nbsp;de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String&lt;/span&gt; como el &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;.equalsIgnorecase()&lt;/span&gt; a los cuales no les prestaremos mucha&amp;nbsp;atención. Solo daremos una&amp;nbsp;explicación&amp;nbsp;muy general sobre esto: El &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while&lt;/span&gt; y el&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;.equalsIgnoreCase()&lt;/span&gt; los usamos para que el programa termine hasta que el usuario lo indique; El &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;switch&lt;/span&gt; lo usamos como apoyo a un&amp;nbsp;menú&amp;nbsp;para que el usuario pueda elegir que&amp;nbsp;operación&amp;nbsp;(&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt; o&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; pop&lt;/span&gt;) desea realizar a su pila.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este programa usamos la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Scanner&lt;/span&gt; y sus&amp;nbsp;métodos&amp;nbsp;para obtener respuestas del usuario.&amp;nbsp;Así&amp;nbsp;que crearemos un objeto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Scanner&lt;/span&gt; para usarlo a conveniencia del programa;&amp;nbsp;También&amp;nbsp;creamos un objeto de nuestra clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt; (que es la que definimos anteriormente) y a nuestro objeto le asignamos el nombre de &quot;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pila&lt;/span&gt;&quot; para poder usar sus&amp;nbsp;métodos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
De la linea 24 a la 28 el programa preguntara al usuario que&amp;nbsp;operación&amp;nbsp;desea realizar, si el usuario responde insertando el valor de 1, entonces en la linea 29 se ejecutara el &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;case 1&lt;/span&gt; del &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;switch&lt;/span&gt; y&amp;nbsp;aquí&amp;nbsp;enviamos un mensaje al usuario pidiendo que ingrese el numero que desea insertar en la pila, cuando el usuario introduce el valor haremos uso de nuestro objeto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pila&lt;/span&gt; de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt; y llamaremos a su&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt; (esto sucede en la linea 33) y le pasamos de&amp;nbsp;parámetro&amp;nbsp;el valor que el usuario nos ha proporcionado y de este modo se ejecutara el algoritmo del meto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;push&lt;/span&gt; que escribimos en la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt; y quedara insertado el valor en la pila.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
De la linea 24 a la 28 si el programa hubiese recibido de respuesta el valor de 2, entonces se&amp;nbsp;pasaría&amp;nbsp;hasta la linea 36 donde&amp;nbsp;entraría&amp;nbsp;al &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;case 2&lt;/span&gt; del &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;switch&lt;/span&gt; y&amp;nbsp;ahí&amp;nbsp;solo se hace de nuestro objeto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pila&lt;/span&gt; de la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt;, quien manda a llamar a su&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pop&lt;/span&gt; que no recibe&amp;nbsp;parámetros&amp;nbsp; esto pasa en la linea 38, cuando el objeto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pila&lt;/span&gt; manda a llamar al meto &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;pop&lt;/span&gt;, este ejecuta el algoritmo que codificamos en la clase &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Pila&lt;/span&gt; y &quot;elimina&quot; el ultimo elemento que fue insertado.&lt;/div&gt;
&lt;br /&gt;
Esto es todo el funcionamiento general de una pila de datos.</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/8271775350463497264/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/pilas-stack.html#comment-form' title='1 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8271775350463497264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8271775350463497264'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/pilas-stack.html' title='Pilas (Stack)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00837924052584084269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlnrYz9SDOnaNQDbnxj33MtsPiivymn0SwdWdJaZJZpsWhiim2HAJEvAwnkJTWjmaOdB0dQ_tVsyzBEOkB-Z72AKMX2G54656JQHlDFKxhNLTwMb89KOV3MNqm1ZFnNcWmj74_OUnCK4wR/s72-c/Pila.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-2107976091027411389</id><published>2013-04-24T20:47:00.000-05:00</published><updated>2013-04-26T00:31:39.522-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Estructuras de Datos"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Longitud de un arreglo</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Al manejar arreglos, nos es de mucha ayuda mucho saber su longitud. Pero no solo su longitud de capacidad nos puede ser de ayuda, hay ciertos casos en los que podríamos llegar a necesitar saber la longitud de cada elemento que se encuentra dentro de nuestro arreglo. Para esto, el siguiente programa te muestra una forma de hacerlo.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: LongitudDeUnArreglo.java
 * @author Bello Cerecero
 * @since 24/04/2013
 * @version 1.0
 */
public class LongitudDeUnArreglo 
{
  public static void main(String[] args) 
  {
    String[] arreglo = new String[10];
    arreglo[0] = &quot;Hola&quot;;
    arreglo[1] = &quot;Tarde&quot;;
        
    System.out.print(&quot;La longitud del arreglo es: &quot;);
    System.out.println(arreglo.length);       
    System.out.print(&quot;La long. del dato en la posicion 0 es: &quot;);
    System.out.println(arreglo[0].length());
    System.out.print(&quot;La long. del dato en la posicion 1 es: &quot;);
    System.out.println(arreglo[1].length());
  }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El programa lo que haces es: crear un arreglo de tipo &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String&lt;/span&gt; con una longitud de 10 (linea 11).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Después, al arreglo en la posición 0 le asignamos la &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String &quot;Hola&quot;&lt;/span&gt; y en la posición 1 le asignamos la &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;String &quot;Tarde&quot;&lt;/span&gt; (lineas 12 y 13).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora en la linea 15 imprimimos en consola solamente, en la linea 16 colocando el nombre de nuestro &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;array &lt;/span&gt;que para este ejemplo es: &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;arreglo&quot;&lt;/span&gt; y llamando al&amp;nbsp;método&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;length&quot;&lt;/span&gt;, nos&amp;nbsp;imprimirá&amp;nbsp;en consola la longitud del arreglo, que para este ejemplo es 10.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 16 imprimimos en consola solamente. En la linea 17 haciendo referencia al elemento que se encuentra en la posición 0 dentro del &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;arreglo&lt;/span&gt; y llamando al método &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;length()&quot;&lt;/span&gt; &lt;b&gt;(la diferencia con el anterior método son los&amp;nbsp;paréntesis)&lt;/b&gt;, esto nos retornara la longitud del elemento &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;Hola&quot;&lt;/span&gt; que es 4.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Lo mismo pasa en la linea 18.&lt;/div&gt;
&lt;br /&gt;
La salida del programa es la siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIKDARZYVGo-mNELd7luJMetef-ITdI85VKuOth3mRG5VsyyXc5SxO62082jyDhSqZ2kYJ6TtOnniAwwyvvlg_1PHFGP90kXQsAkAQeZDbp05eBK0DswAhCWNc6GLxso3R6zv702X_WIAD/s1600/publicacion+longitud+a.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;146&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIKDARZYVGo-mNELd7luJMetef-ITdI85VKuOth3mRG5VsyyXc5SxO62082jyDhSqZ2kYJ6TtOnniAwwyvvlg_1PHFGP90kXQsAkAQeZDbp05eBK0DswAhCWNc6GLxso3R6zv702X_WIAD/s320/publicacion+longitud+a.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/2107976091027411389/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/longitud-de-un-arreglo.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/2107976091027411389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/2107976091027411389'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/longitud-de-un-arreglo.html' title='Longitud de un arreglo'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIKDARZYVGo-mNELd7luJMetef-ITdI85VKuOth3mRG5VsyyXc5SxO62082jyDhSqZ2kYJ6TtOnniAwwyvvlg_1PHFGP90kXQsAkAQeZDbp05eBK0DswAhCWNc6GLxso3R6zv702X_WIAD/s72-c/publicacion+longitud+a.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-4989589235854380143</id><published>2013-04-23T19:45:00.000-05:00</published><updated>2013-04-23T19:45:04.455-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Métodos Numéricos"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Conversión de grados a radianes</title><content type='html'>Este método te ayudara a resolver tu&amp;nbsp;conversión&amp;nbsp;de grados a radianes, solo tienes que pasarle el angulo al que quieres hacer la&amp;nbsp;conversión.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public double conversionGaR(double angulo)
{
  double radianes = (angulo*3.14169)/180;
  return radianes;
}
&lt;/pre&gt;
&lt;br /&gt;
Bien, como vemos es un método muy simple, con un solo&amp;nbsp;parámetro&amp;nbsp;(el angulo) y al hacer la operación retornara la conversión (double).</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/4989589235854380143/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/conversion-de-grados-radianes.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4989589235854380143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4989589235854380143'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/conversion-de-grados-radianes.html' title='Conversión de grados a radianes'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-3473406561124011624</id><published>2013-04-18T23:55:00.000-05:00</published><updated>2013-04-18T23:55:04.421-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Uso de la palabra THIS</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
La palabra this es una referencia al propio objeto en el que estamos. Supongamos que en un método un&amp;nbsp;parámetro&amp;nbsp;tiene el mismo nombre que alguna de nuestra variable de clase, entonces para poder distinguir la sentencia sería de la siguiente manera: this.nombreVariable = nombreParametro&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Existen otros tres posibles usos para la palabra this, estos son:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
- this.atributo. Para acceder a una propiedad del objeto actual.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
- this.método(parámetros). Permite llamara un método del objeto actual con los&amp;nbsp;parámetros indicados.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
- this(parámetros). Permite llamar a un constructor del objeto actual. Esta llamada sólo puede ser empleada &amp;nbsp; &amp;nbsp; &amp;nbsp;en la primera línea de un constructor.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Estos tres usos&amp;nbsp;serán&amp;nbsp;vistos en otras publicaciones, por ahora solo veremos como se hace la referencia al objeto actual. Para esto se realizo el siguiente programa:&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: PalabraThis.java
 * @author BelloCerecero
 * @version 1.0
 * @since 18-abril-2013
 */

public class PalabraThis 
{
   private int puntoX;
   private int puntoY;

   public void actualizar(int puntoX, int puntoY)
   {
      this.puntoX = puntoX;
      this.puntoY = puntoY;
   }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, como vemos tenemos dos variables atributos, que son &quot;puntoX&quot; y &quot;puntoY&quot; y creamos un método al que llamamos &quot;actualizar&quot; que recibe dos parámetros que tienen el mismo nombre que nuestras variables atributo, entonces en la linea 15 a la variable &quot;puntoX&quot; le agregamos la palabra reservada &quot;this&quot; así que queda de la siguiente manera &quot;this.puntoX&quot;, al hacer esto estamos dejando en claro que hacemos referencia a la variable atributo y no al parámetro. Así que a la variable atributo se le asignara el&amp;nbsp;parámetro&amp;nbsp;&quot;puntoX&quot; (sin la palabra reservada this) lo mismo pasa en la linea 16.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/3473406561124011624/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/uso-de-la-palabra-this.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3473406561124011624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3473406561124011624'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/04/uso-de-la-palabra-this.html' title='Uso de la palabra THIS'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-3769033739727160317</id><published>2013-03-03T22:27:00.000-06:00</published><updated>2013-03-03T22:30:39.920-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Método split</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Supongamos que tenemos la siguiente String: &quot;1,2,3,4,5,6&quot;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora, lo que queremos es &quot;meterla&quot; en un arreglo. Pero de forma independiente cada uno de los valores, es decir, que en cada indice quede un elemento.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
indice[0] = 1&lt;/div&gt;
&lt;div&gt;
indice[1] = 2&lt;/div&gt;
&lt;div&gt;
indice[2] = 3&lt;/div&gt;
&lt;div&gt;
indice[3] = 4&lt;/div&gt;
&lt;div&gt;
indice[4] = 5&lt;/div&gt;
&lt;div&gt;
indice[5] = 6&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Entonces este método nos es de mucha ayuda, ya que solo le tenemos que pasar de&amp;nbsp;parámetro&amp;nbsp;un delimitador (en este caso seria la coma &quot;,&quot;), esto quiere decir que al llamar al&amp;nbsp;método&amp;nbsp;quedaría&amp;nbsp;de la siguiente forma:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
aquiVaLaCadena.split(&quot;,&quot;);&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien para ejemplificar mejor veamos el siguiente&amp;nbsp;código&amp;nbsp;que implementa este&amp;nbsp;método.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * @author BelloCerecero
 * @since 3-marzo-2012
 */

public class MetodoSplit 
{
    public static void main(String [] args)
    {
        String cadena = &quot;1,2,3,4,5,6,7,8,9&quot;;
        String[] arreglo = cadena.split(&quot;,&quot;);
        
        for(int i = 0; i &amp;lt; arreglo.length; i++)
        {
            System.out.println(&quot;indice &quot; + i +&quot; = &quot;+arreglo[i]);
        }
    }
}

&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Comencemos en la linea 10, aquí estamos declarando e inicializando una variable de tipo String que tiene: &quot;1,2,3,4,5,6,7,8,9&quot;.
En la linea 11 viene la utilización del método split, pero ¿Que estamos haciendo realmente?
Pues bien primero estamos declarando un arreglo de tipo String  y le asignaremos lo que tiene cadena pero con una particularidad, ya que al agregar el método split estamos diciendo que cada vez que se encuentre un limitador (que en este caso es una &quot;coma&quot;)se guardara en un indice diferente.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp;La salida del programa es la siguiente:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ50u4uXTqWMVy3sNQ7vKQ8079rvBSLbZF1krHxH9drGK6Ih63QKMzgRIDD1C7mCaCPEaWZrb4GUX90A81oMncg2FYKL6kYx9WtQWbzQM7T7aImQc3sGW2oKZQhi4cSDEtvoQW0CgTo17S/s1600/Split.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ50u4uXTqWMVy3sNQ7vKQ8079rvBSLbZF1krHxH9drGK6Ih63QKMzgRIDD1C7mCaCPEaWZrb4GUX90A81oMncg2FYKL6kYx9WtQWbzQM7T7aImQc3sGW2oKZQhi4cSDEtvoQW0CgTo17S/s320/Split.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/3769033739727160317/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/03/metodo-split.html#comment-form' title='1 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3769033739727160317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3769033739727160317'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/03/metodo-split.html' title='Método split'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ50u4uXTqWMVy3sNQ7vKQ8079rvBSLbZF1krHxH9drGK6Ih63QKMzgRIDD1C7mCaCPEaWZrb4GUX90A81oMncg2FYKL6kYx9WtQWbzQM7T7aImQc3sGW2oKZQhi4cSDEtvoQW0CgTo17S/s72-c/Split.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-4034142965236332144</id><published>2013-02-28T22:33:00.000-06:00</published><updated>2013-03-01T16:32:24.687-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Métodos Numéricos"/><title type='text'>Limitar el número de decimales</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
En ciertas&amp;nbsp;ocasiones&amp;nbsp;al manejar&amp;nbsp;números&amp;nbsp;con decimales, al imprimirlos en consola o al mostrarlos en un JTextField salen&amp;nbsp;números&amp;nbsp;con&amp;nbsp;demasiados&amp;nbsp;decimales. Por ejemplo 9.78863242729&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y si solo necesitamos que muestre tres decimales? (Que imprima: 9.788)&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bueno, con este pequeño&amp;nbsp;código&amp;nbsp;podemos solucionar este tipo de&amp;nbsp;inconvenientes&amp;nbsp; pero algo importante que tengo que recalcar, es que NO CAMBIA EL VALOR DEL NUMERO, es decir, que solo le da formato para que lo muestre, ya sea en consola o en un JTextField.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;package ejemplos;
import java.text.DecimalFormat;
/**
 * Archivo: MostrarDecimales.java
 * @author BelloCerecero
 * @since 28-02-2013
 */
public class MostrarDecimales 
{
    public static void main(String[] args) 
    {
      DecimalFormat decimales = new DecimalFormat(&quot;0.0000&quot;);
      double numero = 7.936427373645;

      System.out.println(decimales.format(numero));
    }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bien, comenzamos en la linea 2, para poder hacer uso de la clase &lt;b&gt;DecimalFormat&lt;/b&gt; que es la que nos permitirá hacer nuestro formato de decimales, debemos importarla.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ya estando en el &lt;b&gt;main&lt;/b&gt;, instanciamos la clase &lt;b&gt;DecimalFormat&lt;/b&gt; (linea 12).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y como se puede observar le estamos pasando como parámetro una &lt;b&gt;String&lt;/b&gt; &quot;0.0000&quot; este sera el formato que tendrá nuestro numero al imprimirlo, es decir, que si yo quiero que solo muestre dos decimales, entonces debo de poner como parámetro una &lt;b&gt;String&lt;/b&gt; &quot;0.00&quot;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora declaramos e inicializamos una variable de tipo &lt;b&gt;double&lt;/b&gt; con el valor de 7.936427373645 (Linea 13).
Entonces al imprimir deberá de mostrar en consola: 7.9364&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para probar que esto es cierto en la linea 15 utilizando un &lt;b&gt;System.out.println&lt;/b&gt; ponemos nuestro instancia de clase &quot;decimales&quot; y usando el método &lt;b&gt;format()&lt;/b&gt;, que recibe de&amp;nbsp;parámetro&amp;nbsp;el numero al que dará formato.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/4034142965236332144/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/02/limitar-el-numero-de-decimales.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4034142965236332144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4034142965236332144'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/02/limitar-el-numero-de-decimales.html' title='Limitar el número de decimales'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-2385864782157024731</id><published>2013-01-21T23:54:00.000-06:00</published><updated>2013-03-01T16:33:09.401-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><category scheme="http://www.blogger.com/atom/ns#" term="Tópicos Selectos de Programacion"/><title type='text'>Manejo De Imagenes</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Para el manejo de imágenes en java, utilizamos dos clases de la librería swing, que seria JLabel y ImageIcon, con estas podemos realizar una clase con la cual iremos actualizando la imagen cada vez que queramos.

Definimos nuestra clase de la siguiente manera:

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import javax.swing.ImageIcon;
/**
 * Archivo: ManejoImagen.java
 * @author BelloCerecero
 * @since 6/09/2011
 */
public class ManejoImagen 
{
    private String nombreImagen;
    private ImageIcon imagen;
    
    public ManejoImagen(String nombreImagen)
    {
 this.nombreImagen = nombreImagen;
 imagen = new ImageIcon(nombreImagen + &quot;.gif&quot;);
    }
    
    public ImageIcon getImagen()
    {
 return imagen;
    }
    
    public void setImagen(String nuevaImagen)
    {
 imagen = new ImageIcon(nuevaImagen + &quot;.gif&quot;);
    }
    
    public String getNombreImagen()
    {
 return nombreImagen;
    }
    
    public void setNombreImagen(String nuevoNombre)
    {
 nombreImagen = nuevoNombre;
    }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea uno importamos la clase ImagenIcon, ya dentro de la clase definimos nuestras variables privadas, en este caso sería el nombre de la imagen que es de tipo String y la imagen que es de tipo ImageIcon.
El constructor recibirá de parámetro el nombre de la imagen para que así podamos pasársela de parámetro a nuestra imagen (linea 15).

Ahora ya solo hacemos los getters y setters de nuestras variables de clase, que actualizaran la imagen y la retornaran.

Esta es un simple prueba de como funciona la clase ManejoImagen:&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt; /**
  * Archivo: PruebaImagen.java
  * @autor BelloCerecero
  * @since 21-01-2013
  */
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class PruebaImagen 
{
    public static void main(String[] args) 
    {
 JFrame ventana = new JFrame(&quot;Imagenes&quot;);
 JPanel contenedor = new JPanel();
 JLabel etiquetaImagen = new JLabel();
 ManejoImagen imagen = new ManejoImagen(&quot;+&quot;);
 
 etiquetaImagen.setIcon(imagen.getImagen());
 contenedor.add(etiquetaImagen);
 ventana.add(contenedor);
 ventana.pack();
 ventana.setVisible(true);
 
 imagen.setImagen(&quot;-&quot;);
 etiquetaImagen.setIcon(imagen.getImagen());
    }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para esto utilizamos un JFrame (una ventana), un JPanel (un contenedor) y un JLabel (una etiqueta). Instanciamos cada uno de ellos (lineas de la 14 a la 16) y también instanciamos nuestra clase ManejoImagen (recuerden que aquí le deben de poner el nombre de la imagen).
En la linea 19 a la etiqueta le vamos a actualizar el icon (la imagen) pasando le de parámetro el getter de la imagen. ya solo agregamos la etiqueta al contenedor (linea 20) después agregamos el contenedor a la ventana (linea 21) y con el método &quot;pack&quot; le estamos diciendo a la ventana que tome el tamaño de la imagen. 
El método &quot;setVisible&quot; es para mostrar la ventana.
Ya después solo tendremos que ir actualizando la imagen.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Así queda:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSWIDipgO1KJirFnAo-723s0-RSrjdas5-7P648vNSsvGNK6VZTQ5EJqWzd-_lGuCoA6oSzqlufHAWpvv8YWcDQ8GeSX-WKYrQOv9gaIytHYhnKkFGHvob8MpixWD7MLUVG21HEGhs1aq2/s1600/imagenes1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;261&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSWIDipgO1KJirFnAo-723s0-RSrjdas5-7P648vNSsvGNK6VZTQ5EJqWzd-_lGuCoA6oSzqlufHAWpvv8YWcDQ8GeSX-WKYrQOv9gaIytHYhnKkFGHvob8MpixWD7MLUVG21HEGhs1aq2/s1600/imagenes1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDYqe-eA-NaIWeCAvGxH7Ovf2vXoXOCkPE7OUG7wq9wNsJBbTBno22vNPdQHPTqb05PXPTHm3iWd0tZAcxOxjdtdlsCCGBRahQ_V35Ot30kKTfXuIoSpFOD7tATPhIOZGGyTdv8fAZ05eS/s1600/imagenes2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDYqe-eA-NaIWeCAvGxH7Ovf2vXoXOCkPE7OUG7wq9wNsJBbTBno22vNPdQHPTqb05PXPTHm3iWd0tZAcxOxjdtdlsCCGBRahQ_V35Ot30kKTfXuIoSpFOD7tATPhIOZGGyTdv8fAZ05eS/s1600/imagenes2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;*** NOTA: En este programa no se vera como se realiza el cambio de imagen ya que no estamos manejando Timer o Threads.
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/2385864782157024731/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/01/manejo-de-imagenes.html#comment-form' title='1 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/2385864782157024731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/2385864782157024731'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/01/manejo-de-imagenes.html' title='Manejo De Imagenes'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSWIDipgO1KJirFnAo-723s0-RSrjdas5-7P648vNSsvGNK6VZTQ5EJqWzd-_lGuCoA6oSzqlufHAWpvv8YWcDQ8GeSX-WKYrQOv9gaIytHYhnKkFGHvob8MpixWD7MLUVG21HEGhs1aq2/s72-c/imagenes1.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-7839432806022927409</id><published>2013-01-21T22:41:00.001-06:00</published><updated>2013-03-01T16:33:49.597-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><title type='text'>Estructura básica de un programa orientado a objetos</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Al utilizar POO hacemos que los problemas sean mas sencillos de resolver, ya que lo dividimos en partes. Ahora estas&amp;nbsp;divisiones&amp;nbsp;(por así llamarlos) son los objetos, pero no podemos utilizarlos sin antes haber creado la clase y así poder hacer la instancia de clase. Bien para aclarar esto haremos el muy utilizado ejemplo de una persona. Primero que nada debemos pensar el nombre que llevara la clase, en este caso no hay necesidad de tanto pensarle ya que &quot;Persona&quot; es mas que claro. Ahora tenemos que identificar todos los atributos de una persona, los cuales pueden ser: la edad, estatura y color de pelo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Solo usaremos esas, bien ya que tenemos definidos los atributos de la clase tendremos que asignarle el tipo de dato mas conveniente, en el caso de la edad sería de tipo int, la estatura sería double y el color de pelo sería String.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCplw9xX0prc00mVa1DguYYP5OoqSTDdOAhDFm4_G220R7CXdA2WXKt6rzqWSvR-psxRHoD0Nce9xS1iaW7f8UZYfAcJNrNVf_WVKG1y8EFOgpOhTLAdfOY9j7hYpjzv8O20tU_zQfu8Qx/s1600/Persona.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCplw9xX0prc00mVa1DguYYP5OoqSTDdOAhDFm4_G220R7CXdA2WXKt6rzqWSvR-psxRHoD0Nce9xS1iaW7f8UZYfAcJNrNVf_WVKG1y8EFOgpOhTLAdfOY9j7hYpjzv8O20tU_zQfu8Qx/s1600/Persona.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ya bien definidas&amp;nbsp;nuestras&amp;nbsp;variables de clase, continuamos a programar. El programa&amp;nbsp;tendrá&amp;nbsp;una estructura, que es la siguiente:&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1)&amp;nbsp;Declaración&amp;nbsp;de variables.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2)Constructor.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3)&amp;nbsp;Métodos.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Entonces declaramos las variables de clase, dependiendo el caso pueden llevar la palabra reservada: public, protected o private.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;private int edad;
private double estatura;
private String colorPelo;
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El constructor recibirá de parámetros la edad, la estatura y el color de pelo. Y utilizando la palabra reservada &quot;this&quot; (para hacer referencia a la variable de clase) asignaremos a cada variable de clase el parámetro correspondiente.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public Persona(int edad, double estatura, String colorPelo)
{
  this.edad = edad;
  this.estatura = estatura;
  this.colorPelo = colorPelo;
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Algo muy importante que siempre se tiene que tener en cuenta, son los métodos para actualizar y obtener nuestras variables de clase, estos son los llamados getters y setters. Los métodos que lleven la palabra &quot;get&quot; es para retornar lo que tiene la variable de clase y los métodos que llevan la palabra &quot;set&quot; es para actualizar la variable de clase.

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public String getColorPelo() 
{
  return colorPelo;
}

public void setColorPelo(String colorPelo) 
{
  this.colorPelo = colorPelo;
}

public int getEdad() 
{
  return edad;
}

public void setEdad(int edad) 
{
  this.edad = edad;
}

public double getEstatura() 
{
  return estatura;
}

public void setEstatura(double estatura) 
{
  this.estatura = estatura;
} 
&lt;/pre&gt;
El programa completo quedaría de la siguiente forma:

&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: Persona.java
 * @author Bello Cerecero
 * @since 25/01/2012
 */
public class Persona 
{
    private String colorPelo;
    private int edad;
    private double estatura;
    
    public Persona(String colorPelo, int edad, double estatura)
    {
      this.colorPelo = colorPelo;
      this.edad = edad;
      this.estatura = estatura;
    }

    public String getColorPelo() 
    {
        return colorPelo;
    }

    public void setColorPelo(String colorPelo) 
    {
        this.colorPelo = colorPelo;
    }

    public int getEdad() 
    {
        return edad;
    }

    public void setEdad(int edad) 
    {
        this.edad = edad;
    }

    public double getEstatura() 
    {
        return estatura;
    }

    public void setEstatura(double estatura) 
    {
        this.estatura = estatura;
    } 
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/7839432806022927409/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2013/01/estructura-basica-de-un-programa.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/7839432806022927409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/7839432806022927409'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2013/01/estructura-basica-de-un-programa.html' title='Estructura básica de un programa orientado a objetos'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCplw9xX0prc00mVa1DguYYP5OoqSTDdOAhDFm4_G220R7CXdA2WXKt6rzqWSvR-psxRHoD0Nce9xS1iaW7f8UZYfAcJNrNVf_WVKG1y8EFOgpOhTLAdfOY9j7hYpjzv8O20tU_zQfu8Qx/s72-c/Persona.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-4447301795432937044</id><published>2012-12-01T18:05:00.000-06:00</published><updated>2012-12-15T12:31:15.756-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tópicos Selectos de Programacion"/><title type='text'>Introducción a las interfaces gráficas</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
A medida que vamos adquiriendo mas conocimientos en el mundo de Java, nos damos cuenta que es indispensable hacer nuestros programas &quot;bonitos&quot; y para eso necesitamos implementar gráficos, imágenes, audio, etc. Por ahora solo verán una pequeñisima y austera parte de como se puede hacer una interfaz sencilla.
Este programa es una ayuda para un compañero que recurrió a Buenas Intenciones para despejar ciertas dudas.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Sin mas preámbulos esta es la interfaz que realice:&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg6HgMxN4OgNVdC0rzv3jJN2WM7Y08_O6C5ThXiPRSPZ5wkHe47pR0aTRXZdbHAE4JsAqMU3_KsUQM7cI8MowAePU2ln26158De_Si4C_3uj5X5wEBUYMi-6MYA2JPaUnMK53PC6gVNQRK/s1600/InterfazBI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;277&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg6HgMxN4OgNVdC0rzv3jJN2WM7Y08_O6C5ThXiPRSPZ5wkHe47pR0aTRXZdbHAE4JsAqMU3_KsUQM7cI8MowAePU2ln26158De_Si4C_3uj5X5wEBUYMi-6MYA2JPaUnMK53PC6gVNQRK/s320/InterfazBI.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
(El sistema operativo en el que trabaje fue Linux Mint 13 maya)
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;El código es el siguiente:&lt;/b&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * @author Bello Cerecero
 * @since 1-dic-2012
 */
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Principal extends JFrame implements ActionListener
{
 private JPanel contenedor;
 private JLabel etiquetaToken;
 private JLabel etiquetaResultado;
 private JTextField cajaToken;
 private JTextField cajaResultado;
 private JButton botonAceptar;
 private JButton botonCancelar;

 
 public Principal()
 {
  super(&quot;Interfaz&quot;);
  getContentPane().setLayout(null);
  setLocation(100,100);
        setSize(380,330);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setResizable(false);
        contenedor();
        setVisible(true);
 }
 
 public void contenedor()
 {
  contenedor = new JPanel();
  contenedor.setLayout(null);
  
  etiquetaToken = new JLabel(&quot;Tokens&quot;);
  etiquetaToken.setBounds(30,30,116,16);
  contenedor.add(etiquetaToken);
  
  cajaToken = new JTextField();
  cajaToken.setBounds(100,25,200,30);
  contenedor.add(cajaToken);
  
  botonAceptar = new JButton(&quot;Aceptar&quot;);
  botonAceptar.setBounds(30,100,100,30);
  botonAceptar.addActionListener(this);
  contenedor.add(botonAceptar);
  
  botonCancelar = new JButton(&quot;Cancelar&quot;);
  botonCancelar.setBounds(220,100,100,30);
  botonCancelar.addActionListener(this);
  contenedor.add(botonCancelar);
  
  etiquetaResultado = new JLabel(&quot;Resultado&quot;);
  etiquetaResultado.setBounds(30,180,116,16);
  contenedor.add(etiquetaResultado);
  
  cajaResultado = new JTextField();
  cajaResultado.setBounds(120,175,200,30);
  contenedor.add(cajaResultado);
  
  setContentPane(contenedor);
 }
 
 public void actionPerformed(ActionEvent evento) 
 {
  if(evento.getSource() == botonAceptar)
  {
   //codigo a ejecutarse al dar clic en aceptar
  }
  else if(evento.getSource() == botonCancelar)
  {
   //codigo a ejecutarse al dar clic en cancelar
  }
 }
 
 public static void main(String args [])
 {
  Principal ejemplo = new Principal();
 }
}
&lt;/pre&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt; Análisis:&lt;/b&gt;

Comenzamos en la linea 5, aquí importamos todas las librerías que ocuparemos para la realización de nuestra interfaz (que son la swing y la awt), en la linea 14 comenzara nuestra clase la cual se llama &quot;Principal&quot; que hereda de la clase &quot;JFrame&quot; e implementa &quot;ActionListener&quot;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aquí haremos un pequeños paréntesis para explicar esto un poco mejor, al decir que nuestra clase &quot;Principal&quot; hereda de la clase &quot;JFrame&quot; estamos diciendo que nuestra clase hereda todos los métodos de la clase &quot;JFrame&quot;, así no habrá necesidad de declarar un objeto. Al implementar &quot;ActionListener&quot; estamos diciendo que usaremos su método (que ya se encuentra declarado en esta interface) el cual se llama &quot;actionPerformed&quot;, esté método nos servirá para poder manejar los eventos al dar clic en los botones (ya sea en el botón &quot;aceptar&quot; o en el botón &quot;cancelar&quot;).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Continuando con el análisis, en la linea 16 comenzaremos con la declaración de nuestras variables, como vemos ocuparemos un &quot;JPanel&quot; (linea 16) que tomara el papel de un &quot;contenedor&quot; donde estarán los botones, las etiquetas y los cuadros de texto (En la siguiente imagen se describe lo que vendría siendo el JPanel (color rojo)).
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1D2SVePhcJPC9BlsfTvPA7wsi77Kf22wWzYlmP9BlQ8L1CNQn66CyaPSMRu6WNAszBBJ5v46i84H1QY7gtz4-I_Kx_I1JUy8OnmTWLjXI5wTaDST_eAa27w6ustHSi4EhL8yCK1uDG0Dk/s1600/InterfazBI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;277&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1D2SVePhcJPC9BlsfTvPA7wsi77Kf22wWzYlmP9BlQ8L1CNQn66CyaPSMRu6WNAszBBJ5v46i84H1QY7gtz4-I_Kx_I1JUy8OnmTWLjXI5wTaDST_eAa27w6ustHSi4EhL8yCK1uDG0Dk/s320/InterfazBI.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Se ocuparan dos etiquetas &quot;JLabel&quot; una que es la que dice &quot;Token&quot; y la otra es la que dice &quot;Resultado&quot; (La siguiente imagen muestra cuales son las etiquetas (color azul)).

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHVCPieayvz3DOxP3tShAP0TvwwdMspKb5jUvdyfh3iD2yyqHEOoBmVogAkghZSya8WRHUDbgQqmtxyvyLZS0PwcNYSuIiDgTtDKCQicz4o5rcpZYe6b3h-rs4BhNPqcscRcuh18bqolaj/s1600/InterfazBI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;274&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHVCPieayvz3DOxP3tShAP0TvwwdMspKb5jUvdyfh3iD2yyqHEOoBmVogAkghZSya8WRHUDbgQqmtxyvyLZS0PwcNYSuIiDgTtDKCQicz4o5rcpZYe6b3h-rs4BhNPqcscRcuh18bqolaj/s320/InterfazBI.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
También usaremos dos cajas de texto (linea 19 y 20) y dos botones (linea 21 y 22).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 25 declaramos nuestro constructor, en la linea 27 con &quot;super&quot; pondremos el titulo que tendrá nuestra ventana en este caso &quot;Interfaz&quot;, en la linea 28 lo que se esta haciendo es decirle que la ventana no tendrá diseño, en la linea 29 se usa para dar la localización que tendrá la ventana en nuestra pantalla, en la linea 30 definimos el tamaño de la ventana, en la linea 31 estamos configurando en botón &quot;cerrar&quot; (la &quot;x&quot; que tienen las ventanas en la barra de titulo) para que al dar clic en ella el programa se detenga, en la linea 32 estamos configurando la ventana para que no pueda cambiar su tamaño, en la linea 33 estamos llamando al método contenedor y en la linea 34 hacemos que la ventana se visible.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;En el método &quot;contenedor&quot; (linea 37) configuramos todos los componentes (posición y tamaño), primero creamos un objeto de tipo JPanel (linea 39), este panel no tendrá diseño (linea 40).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Comenzaremos a configurar la etiqueta token:&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Primero declaramos un objeto de la clase &quot;JLabel&quot; al cual le pasaremos de parámetro como queremos que se visualice en la ventana, en este caso sera &quot;Tokens&quot; (linea 42), después definimos la posición y las dimensiones que tendrá la etiqueta (linea 43) y por ultimo lo agregamos al contenedor (linea 44).&amp;nbsp;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora va la caja de texto de la etiqueta Tokens:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Primero creamos el objeto del tipo JTextFiel el cual no recibe parámetros (linea 46), después le damos la posición y las dimensiones (linea 47) y por ultimo lo agregamos al contenedor (linea 48).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora configuramos el botón Aceptar:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Primero creamos el objeto de tipo JButton pasando-le de parámetro el nombre que llevara el botón en este caso &quot;Aceptar&quot; (linea 50), después definimos la posición y dimensiones que tendrá (linea 51), ahora le añadiremos la acción para poder &quot;reconocer&quot; cuando hagan clic en este botón (linea 52) y por ultimo lo añadimos al contenedor.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para los objetos restantes se hace lo mismo.

al terminar de configurar todo, ahora agregamos el contenedor a la ventana (linea 68).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Como ya les había mencionado al inicio, al implementar ActionListener tendremos que usar el método &quot;actionPerformed&quot; (linea 71) que recibe de parámetro el evento, que este caso seria cuando le demos clic a cualquier botón, y para poder distinguir cual fue el botón que recibió el clic usamos un if (linea 73).

Y ya para poder probar el programa hacemos un main (linea 83).







 
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/4447301795432937044/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2012/12/introduccion-las-interfaces-graficas.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4447301795432937044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/4447301795432937044'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2012/12/introduccion-las-interfaces-graficas.html' title='Introducción a las interfaces gráficas'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg6HgMxN4OgNVdC0rzv3jJN2WM7Y08_O6C5ThXiPRSPZ5wkHe47pR0aTRXZdbHAE4JsAqMU3_KsUQM7cI8MowAePU2ln26158De_Si4C_3uj5X5wEBUYMi-6MYA2JPaUnMK53PC6gVNQRK/s72-c/InterfazBI.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-8523687355157535763</id><published>2012-10-16T19:13:00.001-05:00</published><updated>2012-10-16T19:22:00.377-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Convertir de String a char</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Para convertir de String a char deberemos tomar en cuenta que las variables char solo almacenan una solo carácter así que si tenemos una String que contiene mas de un caracteres deberos convertirlos a char e ir guardándolo los caracteres en un arreglo char. Para que quede mas claro todo esto hice un programa que ejemplifica todo lo anterior.

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;package Conversiones;
/**
 * Archivo: Conversiones.java
 * @author BelloCerecero
 * @since 16/10/2012
 */
public class Conversiones
{
  public static void main(String [] args)
  {
    //Cuando leemos una sola letra.
    String cadena = &quot;A&quot;;
    char letra = cadena.charAt(0);
    System.out.println(letra);
    System.out.println(&quot;&quot;);
 
    //Cuando leemos una serie de letras.
    String cadena_de_caracteres = &quot;ndnpsituylznchsp&quot;;
    char array_caracteres [] = cadena_de_caracteres.toCharArray();

    //imprimimos el arreglo
    for(int i = 0; i &amp;lt; array_caracteres.length; i++)
    {
      System.out.print(array_caracteres[i]);
    }
  }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como vemos en la linea 12 tenemos una variable de tipo String que tiene almacenada la letra &quot;A&quot; en este caso, como es solo un carácter, con el método charAt de la clase String podemos hacer la conversión, pasando-le de parámetro el numero 0 por que es el  indice en el que se encuentra la letra &quot;A&quot; en la String.

En la linea 18 tenemos una variable de tipo String que tiene almacenado una serie de caracteres y como las variables char solo pueden almacenar un solo caracter, lo que haremos sera guardar todos los caracteres en un arreglo de tipo char. Para poder realizar esto tendremos que usar el método toCharAt de la clase String, este método lo que hace es convertir toda la cadena a char pero lo almacena en un arreglo. Así que solo se lo asignamos a nuestro arreglo.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/8523687355157535763/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2012/10/convertir-de-string-char.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8523687355157535763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/8523687355157535763'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2012/10/convertir-de-string-char.html' title='Convertir de String a char'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-76140741126641816</id><published>2012-10-15T21:22:00.002-05:00</published><updated>2012-12-15T12:36:35.201-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Operaciones con caracteres en matrices </title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
El manejo de caracteres siempre es de mucha utilidad, sobre todo cuando trabajan con Autómatas. En este programa que hice, define algunos métodos para hacer operaciones con cierta cantidad de caracteres que los guarde en una matriz de 5x5.

El programa es estructurado, muy bien comencemos.

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;    private static char arregloB[][];
    private static int filas = 5;
    private static int columnas = 5;
&lt;/pre&gt;
Pues como les había mencionado que el programa es estructurado, las variables son estáticas para que las pueda utilizar en el main sin necesidad de instancias, la primera variable es arreglo bidimensional de tipo char (solo esta declarado), la segunda es una variable de tipo entero y la llame fila (guarda las filas que tendrá la matriz) y por ultimo la tercera variable que también es de tipo entero y la llame columnas (guarda las columnas que tendrá la matriz).

&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static boolean llenarArregloB(String cadena)
{
   //Checamos que los caracteres quepan en la matriz
   if(cadena.length() &amp;gt; (filas*columnas))
      return false;
   else
   {
      arregloB = new char [filas][columnas];
      int contador = 0;
   
      for(int i = 0; i &amp;lt; filas; i++)
      {
         for(int j = 0; j &amp;lt; columnas; j++)
         {
            if(contador &amp;lt; cadena.length())
            {
               arregloB[i][j] = cadena.charAt(contador);
               contador += 1;
            }
            else 
               break;
         }
      }
      return true;
   }
}
&lt;/pre&gt;
Define un método al que que llame llenarArregloB y este recibe de parámetro una cadena (en la que vienen todos los caracteres que el usuario introdujo), aquí en este método también inicializamos la matriz, y con dos for anidados procedemos a rellenar la matriz, pero como todos los caracteres viene en una sola cadena, utilizaremos el método charAt para pasarlos a tipo char.

&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void imprimir()
{
   for(int i = 0; i &amp;lt; filas; i++)
   {
      for(int j = 0; j &amp;lt; columnas; j++)
      {
         System.out.print(arregloB[i][j] + &quot;\t&quot;);
      }
      System.out.println(&quot;&quot;);
   }
}
&lt;/pre&gt;
Con este método imprimiré la información de la matriz.


&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void ordenar()
{
   for( int i=0; i &amp;lt; filas; i++)
   {
      for( int j=0;j&amp;lt; columnas; j++)
      {
         for(int x=0; x &amp;lt; filas; x++)
         {
            for(int y=0; y &amp;lt; columnas; y++)
            {
               if(arregloB[i][j] &amp;lt; arregloB[x][y])
               {
                  char t = arregloB[i][j];
                  arregloB[i][j] = arregloB[x][y];
                  arregloB[x][y] = t;
               }
            }
         }
      }
   }
}
&lt;/pre&gt;
El método de ordenar lo que hace es ordenar los caracteres de forma ascendente (con base al codigo ASCII)&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void ordenarAlReves()
{
   for( int i=0; i &amp;lt; filas; i++)
   {
      for( int j=0;j&amp;lt; columnas; j++)
      {
         for(int x=0; x &amp;lt; filas; x++)
         {
            for(int y=0; y &amp;lt; columnas; y++)
            {
               if(arregloB[i][j] &amp;gt; arregloB[x][y])
               {
                  char t = arregloB[i][j];
                  arregloB[i][j] = arregloB[x][y];
                  arregloB[x][y] = t;
               }
             }
          }
       }
   }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método ordenarAlReves ordena los caracteres de la matriz de forma descendente (con respecto al código ASCII)

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void contarMayusculas()
{
   Character c = null;
   int contador = 0;
   for(int i = 0; i &amp;lt; filas; i++)
   {
      for(int j = 0; j &amp;lt; columnas; j++)
      {
         if(c.isUpperCase(arregloB[i][j]))
            contador++;
      }
   }
   System.out.println(&quot;Hay &quot; + contador + &quot;Mayusculas\n&quot;);
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método contarMayuscula va a hacer un recorrido por la matriz y contara las mayúsculas que encuentre para imprimirlas en consola (solo imprimirá en numero de letras).

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void contarMinusculas()
{
   Character c = null;
   int contador = 0;
   for(int i = 0; i &amp;lt; filas; i++)
   {
      for(int j = 0; j &amp;lt; columnas; j++)
      {
         if(c.isLowerCase(arregloB[i][j]))
           contador++;
      }
   }
   System.out.println(&quot;Hay &quot; + contador + &quot;Minusculas\n&quot;);
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método contarMinusculas va a hacer un recorrido por la matriz y contara las minúsculas que encuentre para imprimirlas en consola (solo imprimirá en numero de letras).

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void convertirAMayusculas()
{
   Character c = null;
   char aux;
      for(int i = 0; i &amp;lt; filas; i++)
      {
         for(int j = 0; j &amp;lt; columnas; j++)
         { 
            aux = arregloB[i][j];
            arregloB[i][j] = c.toUpperCase(aux);
         }
      }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método contarMayuculas va a hacer un recorrido por la matriz y contara todas las mayúsculas que encuentre (solo imprimirá el numero de mayúsculas).

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void convertirAMinusculas()
{
   Character c = null;
   char aux;
   for(int i = 0; i &amp;lt; filas; i++)
   {
      for(int j = 0; j &amp;lt; columnas; j++)
      {
         aux = arregloB[i][j];
         arregloB[i][j] = c.toLowerCase(aux);
      }
   }
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método contarMinusculas va a hacer un recorrido por la matriz y contara todas las minúsculas que encuentre (solo imprimirá el numero de minúsculas).

&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public static void main(String[] args) 
{
  String cadena = JOptionPane.showInputDialog(&quot;Introduce los&quot; 
                   + &quot; caracteres a evaluar: &quot;);
  llenarArregloB(cadena);
  System.out.println(&quot;La matriz queda de la sigueinte manera:&quot;);
  imprimir();
  System.out.println(&quot;\n Ordenamiento Ascendente: &quot;);
  ordenar();
  imprimir();
  System.out.println(&quot;\n Ordenamiento Decendente: &quot;);
  ordenarAlReves();
  imprimir();
  System.out.println(&quot;&quot;);
  contarMayusculas();
  contarMinusculas();
}
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ahora ya en en main, aquí le pediremos al usuario que introduzca los caracteres con un JOptionPane y mandaremos llamar al método llenarArregloB pasando le como parámetro la cadena y ya después solo tendremos que mandar llamar el método que queramos e imprimir.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
código&amp;nbsp;completo:&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import javax.swing.JOptionPane;
/**
 * Archivo: Principal.java
 * @author BelloCercero
 * @since 13/10/2012
 */
public class Principal 
{
    private static char arregloB[][];
    private static int filas = 5;
    private static int columnas = 5;
    
    public static boolean llenarArregloB(String cadena)
    {
 if(cadena.length() &amp;gt; (filas*columnas))
     return false;

 else
 {
     arregloB = new char [filas][columnas];
     int contador = 0;
     
     for(int i = 0; i &amp;lt; filas; i++)
     {
  for(int j = 0; j &amp;lt; columnas; j++)
  {
      if(contador &amp;lt; cadena.length())
      {
   arregloB[i][j] = cadena.charAt(contador);
   contador += 1;
      }
      else 
   break;
  }
   }
     return true;
 }
 
    }
    
    public static void imprimir()
    {
 for(int i = 0; i &amp;lt; filas; i++)
 {
     for(int j = 0; j &amp;lt; columnas; j++)
     {
  System.out.print(arregloB[i][j] + &quot;\t&quot;);
     }
     System.out.println(&quot;&quot;);
 }
    }
    
    public static void ordenar()
    {
 for( int i=0; i &amp;lt; filas; i++)
 {
     for( int j=0;j&amp;lt; columnas; j++)
     {
  for(int x=0; x &amp;lt; filas; x++)
  {
      for(int y=0; y &amp;lt; columnas; y++)
      {
   if(arregloB[i][j] &amp;lt; arregloB[x][y])
   {
       char t = arregloB[i][j];
       arregloB[i][j] = arregloB[x][y];
       arregloB[x][y] = t;
   }
      }
  }
     }
 }
    }
    
    public static void ordenarAlReves()
    {
 for( int i=0; i &amp;lt; filas; i++)
 {
     for( int j=0;j&amp;lt; columnas; j++)
     {
  for(int x=0; x &amp;lt; filas; x++)
  {
      for(int y=0; y &amp;lt; columnas; y++)
      {
   if(arregloB[i][j] &amp;gt; arregloB[x][y])
   {
       char t = arregloB[i][j];
       arregloB[i][j] = arregloB[x][y];
       arregloB[x][y] = t;
   }
      }
  }
     }
 }
    }
    
    public static void contarMayusculas()
    {
 Character c = null;
 int contador = 0;
 for(int i = 0; i &amp;lt; filas; i++)
 {
     for(int j = 0; j &amp;lt; columnas; j++)
     {
  if(c.isUpperCase(arregloB[i][j]))
      contador++;
     }
 }
 System.out.println(&quot;Hay &quot; + contador + &quot;Mayusculas\n&quot;);
    }
    
    public static void contarMinusculas()
    {
 Character c = null;
 int contador = 0;
 for(int i = 0; i &amp;lt; filas; i++)
 {
     for(int j = 0; j &amp;lt; columnas; j++)
     {
  if(c.isLowerCase(arregloB[i][j]))
      contador++;
     }
 }
 System.out.println(&quot;Hay &quot; + contador + &quot;Minusculas\n&quot;);
    }
    
    public static void convertirAMayusculas()
    {
 Character c = null;
 char aux;
 for(int i = 0; i &amp;lt; filas; i++)
 {
     for(int j = 0; j &amp;lt; columnas; j++)
     {
  aux = arregloB[i][j];
  arregloB[i][j] = c.toUpperCase(aux);
     }
 }
    }
    
    public static void convertirAMinusculas()
    {
 Character c = null;
 char aux;
 for(int i = 0; i &amp;lt; filas; i++)
 {
     for(int j = 0; j &amp;lt; columnas; j++)
     {
  aux = arregloB[i][j];
  arregloB[i][j] = c.toLowerCase(aux);
     }
 }
    }
    public static void main(String[] args) 
    {
 String cadena = JOptionPane.showInputDialog(&quot;Introduce los caracteres a evaluar: &quot;);
 llenarArregloB(cadena);
 System.out.println(&quot;La matriz queda de la sigueinte manera:&quot;);
 imprimir();
 System.out.println(&quot;\n Ordenamiento Ascendente: &quot;);
 ordenar();
 imprimir();
 System.out.println(&quot;\n Ordenamiento Decendente: &quot;);
 ordenarAlReves();
 imprimir();
 System.out.println(&quot;&quot;);
 contarMayusculas();
 contarMinusculas();
    }
}

&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Cualquier duda dejen su comentario.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/76140741126641816/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2012/10/operaciones-con-caracteres-con-matrices.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/76140741126641816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/76140741126641816'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2012/10/operaciones-con-caracteres-con-matrices.html' title='Operaciones con caracteres en matrices '/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-1484881731809199941</id><published>2012-09-21T17:58:00.004-05:00</published><updated>2012-09-21T18:08:45.183-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><title type='text'>Switch con cadenas (String)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Ayer en la noche estaba checando algunos blogs, y me&amp;nbsp;encontré&amp;nbsp;con unos comentarios sobre las novedades de java 7. Y pues son varias cosas que mejoraron, pero hoy solo les dire sobre el switch con cadenas, ya que de por si, con el simple echo de que solo se&amp;nbsp;podía&amp;nbsp;con números y nos era y sigue siendo de gran utilidad, ahora que incluye el manejo de String esta mucho que mejor \(._.)/&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En fin sin mas que decir&amp;nbsp;aquí&amp;nbsp;les dejo un ejemplo. Es un programa muy sencillo que solo pide el nombre de un alumno y entra al switch para ver si el nombre que&amp;nbsp;escribimos&amp;nbsp;esta en los casos.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import java.util.Scanner;
/**
 * Archivo: PruebaS.java
 * @author BelloCerecero
 * @sinse 21/09/2012
 */
public class PruebaS 
{
    public static void main(String[] args) 
    {
 Scanner entrada = new Scanner(System.in);
 System.out.println(&quot;Introduce el nombre del alumno:\t&quot;);
 String alumno = entrada.next();
 
 switch(alumno)
 {
  case &quot;Juan&quot;:
      System.out.println(&quot;Selecciono al alumno juan...&quot;);
      break;
  
  case &quot;Luis&quot;:
      System.out.println(&quot;Selecciono al alumno luis...&quot;);
      break;  
      
  default:
      System.out.println(&quot;No selecciono a ningun alumno...&quot;);
      break;
 }
    }
}&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 1 como vamos a usar el Scanner lo importamos, de ahí en las lineas 2 a 6 son comentarios simplemente, entonces ya habiendo echo la clase(linea 7) y el main (linea 9) entramos a realizar una pequeña prueba para ver como funciona el Switch con cadenas.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Entonces vamos a la linea 11 donde creamos un objeto de Scanner para poder leer datos que el usuario introduzca por medio de la consola. Ahora en la linea 12 con un System.out.println le pedimos al usuario que introduzca algún nombre y este nombre lo guardamos en una variable de tipo String (linea 13).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Nuestra variable String que en este caso le puse de nombre &quot;alumno&quot; la voy a utilizar para que el Switch la evalue con los case.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Entonces vemos en la linea 15 en el Switch le pasamos la variable alumno y ya dentro del switch solo puse dos case uno donde evaluara si lo que tiene la variable alumno es igual a &quot;Juan&quot; si esto es correcto entrara al case y solo imprimirá en consola &quot;Selecciono al alumno juan...&quot; es lo mismo en el case &quot;Luis&quot; si lo que tiene la variable alumno es igual a &quot;Luis&quot; entonces entrara al case e imprimirá en consola &quot;Selecciono al alumno luis...&quot;, si el usuario introdujo otro nombre a &quot;Juan&quot; o &quot;Luis&quot; se ejecutara el &quot;default&quot;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Debemos tener muy en cuenta de que el switch toma en cuenta minúsculas y mayúsculas, así que si escribimos &quot;juan&quot; se ejecutar el default, tenemos que escribir tal y como este en el case en este caso tenemos que escribir &quot;Juan&quot; para que entre correctamente.

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/1484881731809199941/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2012/09/switch-con-cadenas-string.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1484881731809199941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/1484881731809199941'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2012/09/switch-con-cadenas-string.html' title='Switch con cadenas (String)'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1185936420227849811.post-3309362313516611329</id><published>2012-08-23T22:56:00.000-05:00</published><updated>2012-08-27T13:19:21.143-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Estructurada"/><category scheme="http://www.blogger.com/atom/ns#" term="Programacion Orientada a Objetos"/><title type='text'>Introducción a los métodos</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
¡Que tal amigos!, en esta ocasión les hablare acerca del uso de los&amp;nbsp;métodos&amp;nbsp;en java, pero de una forma muy simple, solo para que tengan la idea de como es que funcionan estos; Para ejemplificar esto, hice un programa que verifica si un numero es par o impar.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para esto hice una clase llamada &quot;NumeroPar.java&quot; esta clase tiene un método llamado &quot;esPar&quot; este método recibe de&amp;nbsp;parámetro&amp;nbsp;un número que sera evaluado para verificar si es par o impar, y si este número mencionado antes es par el método retornara &quot;true&quot; y si el número es impar retornara &quot;false&quot;, sin mas&amp;nbsp;preámbulos&amp;nbsp;aquí&amp;nbsp;les dejo el&amp;nbsp;código&amp;nbsp;de la clase &quot;NumeroPar.java&quot; (la descripción del funcionamiento de la clase esta abajo de la misma).&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/**
 * Archivo: NumeroPar.java
 * @author @BelloCerecero
 */
public class NumeroPar 
{
    //Constructor.
    public NumeroPar()
    {
    }
    
    public boolean esPar(int numero)
    {
 if((numero % 2) == 0)
     return true;
 
 return false;
    }
}&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Comencemos con el&amp;nbsp;análisis linea por linea.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como se puede observar de la linea 1 a la linea 4 son comentarios que nos sirven solo como referencia, ahora nos ubicamos en la linea 7 (ya dentro de la clase) aquí es nuestro constructor que en esta ocación no tiene nada dentro de el, así quedara ya que a nosotros nos interesa por ahora es el método, muy bien ahora vamos a la linea 11 aquí se encuentra nuestro método.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
El método esPar tiene las siguientes&amp;nbsp;características:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
es publico (public), retornara un &quot;verdadero&quot; (true) o un &quot;falso&quot; (false) y recibe como&amp;nbsp;parámetro&amp;nbsp;un número.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la siguiente imagen se describe con mas detalles las partes que llevan los&amp;nbsp;métodos:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7CBeuhETBx1YtDX53JYE2-RBStYpTaHI7XAtazkhLmKRnMhIDpuCeni4z5MjVW1oaOIUdJUcsp9agXEL6FiGGYCQQxde14lk7JIMTYBhKndV0vvtGMGKVWQr6p7F2VqoQZnmVZcdh5TRY/s1600/descripcionmetodo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7CBeuhETBx1YtDX53JYE2-RBStYpTaHI7XAtazkhLmKRnMhIDpuCeni4z5MjVW1oaOIUdJUcsp9agXEL6FiGGYCQQxde14lk7JIMTYBhKndV0vvtGMGKVWQr6p7F2VqoQZnmVZcdh5TRY/s1600/descripcionmetodo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Ahora, siguiendo con la clase. Nos &amp;nbsp;vamos a la linea 13 aquí es donde hacemos la operación para saber si el método es par, para esto utilizamos una condición (if) dentro de esta condición hacemos una operación por&amp;nbsp;módulo, que como ya sabemos la operación por modulo lo que hace es una división pero solo retorna el residuo, y como sabemos una de las&amp;nbsp;características&amp;nbsp;de los&amp;nbsp;números&amp;nbsp;pares es que son&amp;nbsp;múltiplos&amp;nbsp;de 2. Así que por&amp;nbsp;lógica&amp;nbsp;al ser divididos entre dos el residuo debe de ser 0, por ende en otras palabras lo que estamos haciendo en la linea 13 es lo siguiente:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&quot;Si residuo de la división de numero entre 2 es igual a cero entonces.... &quot;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
En la linea 14 retornamos true si la condición se cumple y en la linea 16 si no se cumple la condición.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Muy bien ahora ya tenemos nuestra clase NumeroPar.java con un método llamado &quot;esPar&quot; el cual recibe de&amp;nbsp;parámetro&amp;nbsp;el cual es evaluado y retorna true si es par de lo contrario retorna false (que no es par). Ahora haremos una clase aparte para probar nuestra clase NumeroPar.java, esta clase de que llamaremos &quot;PruebaNumeroPar.java&quot; lo que &amp;nbsp;hará&amp;nbsp;es pedirle al usuario un numero entero y mostrar un mensaje diciendo si es par o impar, La clase&amp;nbsp;quedaría&amp;nbsp;de la siguiente manera:&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import javax.swing.JOptionPane;
/**
 * Archivo: PruebaNumeroPar.java
 * @author @BelloCerecero
 *
 */
public class PruebaNumeroPar 
{
    public static void main(String[] args) 
    {
 String valor;
 int numero;
 NumeroPar numeroPar = new NumeroPar();
 valor = JOptionPane.showInputDialog(&quot;Introduce un numero:&quot;);
 numero = Integer.parseInt(valor);
 
 if(numeroPar.esPar(numero))
     JOptionPane.showMessageDialog(null,
           &quot;Es un numero par :)&quot;);
 else 
     JOptionPane.showMessageDialog(null,
           &quot;No es un numero par :(&quot;);
    }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Empecemos, en la linea 1 lo que hacemos es importar la&amp;nbsp;librería&amp;nbsp;&quot;JOptionPane&quot; que la utilizaremos para interactuar con el usuario (ventanas), &amp;nbsp;de la linea 2 a la 6 son comentarios de referencia solamente, ya dentro de la clase y el main (linea 11) declaramos una variable de tipo &quot;String&quot; a la que llamaremos valor, esta nos&amp;nbsp;servirá&amp;nbsp;para guardar el numero que introduzca el usuario (pero se guardara como &quot;String&quot; así que lo tendremos que convertir a &quot;int&quot;), en la linea 12 declaramos una variable de tipo &quot;int&quot; que la ocuparemos para hacer la&amp;nbsp;conversión&amp;nbsp;de la variable &quot;String&quot; (valor).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En la linea 13 declaramos e inicializamos el objeto &quot;numeroPar&quot; que es de nuestra clase &quot;NumeroPar&quot;. Ahora en la linea 14 a la variable &quot;valor&quot; le vamos a asignar el número que introduzca el usuario (con el &quot;JOptionPane.showInputDialog&quot; que no es mas que una ventanita), pero como el numero que introdujo el usuario lo guardamos en una variable de tipo &quot;String&quot; no podemos hacer la operación por modulo, así que tenemos convertir lo que tenga la variable &quot;valor&quot; a int, eso es lo que hacemos en la linea 15 como vemos a la variable numero (que es de tipo int) le asignamos lo que tenga la variable &quot;valor&quot; (que es de tipo &quot;String&quot;) pero convertido a entero (para eso se una esto &quot;Integer.parseInt(valor)&quot;) con el&amp;nbsp;Integer.parseInt podemos convertir cualquier String a entero.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Muy bien, ahora nos ubicamos en la linea 17 aquí es donde mandamos traer nuestro método &quot;esPar&quot; para poder describir mejor el como debemos llamar nuestros métodos&amp;nbsp;échenle&amp;nbsp;un vistazo a la imagen siguiente:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwI7rMWJrtKMPw9SkwMnLmkyNqZEmxsrJTrMKrXgb1EcL7VOF8oFIcPTAvNo2Df2pZsgKlRqKW1cwz1ZYBI8-MY1YcKqLY5lk0ZAHN-cZA-k2XfOUneURJh1EnjD9Wp0iosrAV6jJqzpL6/s1600/metodo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;177&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwI7rMWJrtKMPw9SkwMnLmkyNqZEmxsrJTrMKrXgb1EcL7VOF8oFIcPTAvNo2Df2pZsgKlRqKW1cwz1ZYBI8-MY1YcKqLY5lk0ZAHN-cZA-k2XfOUneURJh1EnjD9Wp0iosrAV6jJqzpL6/s1600/metodo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Seguimos en la linea 17 aquí usamos un &quot;if&quot; dentro de este mandamos traer nuestro método (ver la imagen de arriba) y como sabemos nos va a retorna un true o un false si es true entramos a la linea 18 donde usaremos un &quot;JOptionPane.showMessageDialog&quot; para mostrar un mensaje en una ventana que diga: &quot;Es un numero par :)&quot;, si el método retorna un false entonces se&amp;nbsp;ejecutara&amp;nbsp;el else (linea 20) y entraremos a la linea 21 donde con un&amp;nbsp;&quot;JOptionPane.showMessageDialog&quot; mostraremos un mensaje en una ventana que diga:&amp;nbsp;&quot;No es un numero par :(&quot;. Pues eso seria todo amigos, a continuación les dejo una serie de imagines que mostraran como se ejecuta el programa que es de la siguiente manera:&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Primero lo ejecute e introduje un numero par (el numero2).&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
1.- Pide un numero al usuario.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgem6RWTIcAQ3u1_GOyqvXDzjGeLy09rDWwKufORPBYJfRLHboIQijNGsTNzzkTxKFMlFggWOM4E2Aq4hFm9dqNov7EKOhvp620TT5w8zsdvc90K-t2BhAGv-e_Zr0xqQDwOdSTWqwJxF3P/s1600/ventana1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgem6RWTIcAQ3u1_GOyqvXDzjGeLy09rDWwKufORPBYJfRLHboIQijNGsTNzzkTxKFMlFggWOM4E2Aq4hFm9dqNov7EKOhvp620TT5w8zsdvc90K-t2BhAGv-e_Zr0xqQDwOdSTWqwJxF3P/s1600/ventana1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
2.-&amp;nbsp;Evalúa&amp;nbsp;el numero y nos dice si es par o impar.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2CoB_TCu5aJ8F_k_lWEmh8E3fooC7epCxLrVd-lo14l6O6rB3TZsSyw8_TBOkCMC3hFYrqZ3wT_zA8uGufpu0Sn6Z0cRA_ycb-l8XpfZw4zTkVzwVgHR1kmxIOC_SS8bU2YSOircbJMZP/s1600/ventana2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2CoB_TCu5aJ8F_k_lWEmh8E3fooC7epCxLrVd-lo14l6O6rB3TZsSyw8_TBOkCMC3hFYrqZ3wT_zA8uGufpu0Sn6Z0cRA_ycb-l8XpfZw4zTkVzwVgHR1kmxIOC_SS8bU2YSOircbJMZP/s1600/ventana2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Después&amp;nbsp;lo ejecute y introduje un numero impar (el numero 3).&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
1.- Pide un numero al usuario.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYwW_yn_rP7IvZZwZ9YeP52J76nztaua5IfB1GLWY6fCVSjxkl40ZEGd8OIvAeDGVlwvRETpzFqk85lf6jrgePd_1oSDUoBqItsrb2-0uIamsnFhFtv2TCsgmO_Ex1gIZ9vFkhKjMuGGdy/s1600/ventana3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;112&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYwW_yn_rP7IvZZwZ9YeP52J76nztaua5IfB1GLWY6fCVSjxkl40ZEGd8OIvAeDGVlwvRETpzFqk85lf6jrgePd_1oSDUoBqItsrb2-0uIamsnFhFtv2TCsgmO_Ex1gIZ9vFkhKjMuGGdy/s1600/ventana3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
2.-&amp;nbsp;Evalúa&amp;nbsp;el numero y nos dice si es par o impar.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_et5zSx_q7vsZtEih-gHlq8C-uu5TsThqXh8Ylnbifs7E6liNLDRwtQp3SD8rAeOl3KWadRvsft-pXqTWWYFk4BwW2KByiyr01TT1lYJXptVzKN9qUZ5xcdpaQpMFRuRDtUzX0k7_6WpO/s1600/ventana4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_et5zSx_q7vsZtEih-gHlq8C-uu5TsThqXh8Ylnbifs7E6liNLDRwtQp3SD8rAeOl3KWadRvsft-pXqTWWYFk4BwW2KByiyr01TT1lYJXptVzKN9qUZ5xcdpaQpMFRuRDtUzX0k7_6WpO/s1600/ventana4.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Eso es todo gracias por visitar nuestro blog.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://buenasintencions.blogspot.com/feeds/3309362313516611329/comments/default' title='Comentarios de la entrada'/><link rel='replies' type='text/html' href='http://buenasintencions.blogspot.com/2012/08/introduccion-los-metodos.html#comment-form' title='0 Comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3309362313516611329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1185936420227849811/posts/default/3309362313516611329'/><link rel='alternate' type='text/html' href='http://buenasintencions.blogspot.com/2012/08/introduccion-los-metodos.html' title='Introducción a los métodos'/><author><name>Luis Angel Bello Cerecero</name><uri>http://www.blogger.com/profile/16461249399878236927</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguxCIGaRm4rd6plXz7P5e-kbV5nhBQsfqEZiT8AFHR_Vxj65Pm4VV2zkINY9YRUGmBb8SucYr8zEXsiC_zC9s8SdIuNv11G2P-7UNaCijcWn_vItsps4Oy0Zs4zVqBY8/s113/Archivo_000.jpeg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7CBeuhETBx1YtDX53JYE2-RBStYpTaHI7XAtazkhLmKRnMhIDpuCeni4z5MjVW1oaOIUdJUcsp9agXEL6FiGGYCQQxde14lk7JIMTYBhKndV0vvtGMGKVWQr6p7F2VqoQZnmVZcdh5TRY/s72-c/descripcionmetodo.png" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Chilpancingo, GRO, México</georss:featurename><georss:point>17.4391926 -99.5450974</georss:point><georss:box>15.494611099999998 -102.0719529 19.383774099999997 -97.0182419</georss:box></entry></feed>