<?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-4589601546169459793</id><updated>2024-09-05T22:30:01.612-06:00</updated><category term="Como Programar en Java"/><category term="Java"/><category term="Println"/><category term="Printf"/><category term="System"/><category term="Print"/><category term="Ejercicio"/><category term="Out"/><category term="if-else"/><category term="Scanner"/><category term="Deitel"/><category term="For"/><category term="While"/><category term="static. new"/><category term="nextInt"/><category term="double"/><category term="Graphics"/><category term="Integer"/><category term="JFrame"/><category term="JPanel"/><category term="PaintComponent"/><category term="ESAPI"/><category term="Modulo"/><category term="New"/><category term="OWASP"/><category term="Seguridad"/><category term="SerialVersionUID"/><category term="void"/><category term="Configuración"/><category term="Instalación"/><category term="Random"/><category term="XSS"/><category term="do - while"/><category term="final"/><category term="ESAPI4JS"/><category term="switch"/><category term="Bienvenidad"/><category term="Cast"/><category term="InputMismatchException"/><category term="JOptionpane"/><category term="JSP"/><category term="Leyes Morgan"/><category term="Operaciones Basicas"/><category term="String"/><category term="USO"/><category term="getter"/><category term="main"/><category term="parseInt"/><category term="setter"/><category term="showInputDialog"/><category term="showMessageDialog"/><category term="try-catch"/><title type='text'>Cenando con Bytes</title><subtitle type='html'>Un blog dedicado a los bytes, al lenguaje java y diferentes frameworks que se emplearan poco a poco.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>67</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-2500279386253502166</id><published>2011-10-06T21:55:00.000-05:00</published><updated>2011-10-06T21:55:00.862-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Random"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 6.34</title><content type='html'>Aquí esta el ejercicio 6.34 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capituloseis&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de realizar el juego de adivina&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; un número y arroja un mensaje dependiendo el&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; número de intentos que realizo el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6.34&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; AdivinaNumeroSecreto &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de generar un número aleatorio&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entre &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; e indicar si el usuario se acerco&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; o no al número.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt; aleatorio &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; aleatorio&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Adivine un número entre 1 a 1000&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; ingresado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado bajo. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado alto. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;FELICIDADES. Adivino el número!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;O ya sabía ustede el secreto, &quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;o tuvo suerte!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Debería haberlo hecho mejor.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Aja! Sabia usted el secreto!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        AdivinaNumeroSecreto numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; AdivinaNumeroSecreto&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            numero&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Quiere adivinar otro número? &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;(1) Si, (Otro) No&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/2500279386253502166/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-634.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/2500279386253502166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/2500279386253502166'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-634.html' title='Como Programar en Java: Ejercicio 6.34'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-1417779893165375474</id><published>2011-10-06T21:44:00.000-05:00</published><updated>2012-11-29T13:49:44.007-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Random"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 6.34</title><content type='html'>Aquí esta el ejercicio 6.34 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capituloseis&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de realizar el juego de adivina&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; un número y arroja un mensaje dependiendo el&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; número de intentos que realizo el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6.34&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; AdivinaNumeroSecreto &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de generar un número aleatorio&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entre &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; e indicar si el usuario se acerco&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; o no al número.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt; aleatorio &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; aleatorio&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Adivine un número entre 1 a 1000&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; ingresado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado bajo. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado alto. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;FELICIDADES. Adivino el número!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;O ya sabía ustede el secreto, &quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;o tuvo suerte!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Debería haberlo hecho mejor.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Aja! Sabia usted el secreto!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        AdivinaNumeroSecreto numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; AdivinaNumeroSecreto&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            numero&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Quiere adivinar otro número? &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;(1) Si, (Otro) No&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/1417779893165375474/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-634_6.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1417779893165375474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1417779893165375474'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-634_6.html' title='Como Programar en Java: Ejercicio 6.34'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-5160134887365478853</id><published>2011-10-05T21:43:00.000-05:00</published><updated>2011-10-05T21:43:04.137-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="New"/><category scheme="http://www.blogger.com/atom/ns#" term="Random"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 6.33</title><content type='html'>Aquí esta el ejercicio 6.33 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capituloseis&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de realizar el juego de adivina&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; un número.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6.33&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; AdivinaNumero &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de generar un número aleatorio&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entre &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; e indicar si el usuario se acerco&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; o no al número.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt; aleatorio &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Random&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; aleatorio&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Adivine un número entre 1 a 1000&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;aAdivinar &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; ingresado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            ingresado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado bajo. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ingresado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; aAdivinar&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Demasiado alto. Intente de nuevo.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;FELICIDADES. Adivino el número!&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        AdivinaNumero numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; AdivinaNumero&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            numero&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;adivinar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Quiere adivinar otro número? &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;(1) Si, (Otro) No&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            opcion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/5160134887365478853/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-633.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5160134887365478853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5160134887365478853'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-633.html' title='Como Programar en Java: Ejercicio 6.33'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-8889708808057205777</id><published>2011-10-02T19:00:00.000-05:00</published><updated>2011-10-02T19:00:25.746-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="switch"/><title type='text'>Como Programar en Java: Ejercicio 5.29</title><content type='html'>Aquí esta el ejercicio 5.29 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir Twelve Days&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.29&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; DoceDias &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir la cancion de los&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; doce dias.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; dia &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; dia &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; dia&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;One &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Two &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Three &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Four &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Five &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Six &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Seven &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Eight &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Nine &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Ten &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Eleven &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Twelve &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir fragmentos de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; la cancion correspondiente al dÃ­a.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; dia int Con el fragmento correspondiente&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; al dÃ­a.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimirFragmento&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;dia&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;True Love refers to God&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Turtle Doves refers to the Old &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;and New Testaments&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;French Hens refers to Faith, &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Hope and Charity, the Theological Virtues&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Calling Birds refers to the Four &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Gospels and/or the Four Evangelists&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Golden Rings refers to the first Five &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Books of the Old Testament, the &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Pentateuch&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;, &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;which gives the history of man&#39;s fall from grace.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Geese A-laying refers to the six days &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;of creation&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Swans A-swimming refers to the seven gifts &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;of the Holy Spirit, the sacraments&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Maids A-milking refers to the eight &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;beatitudes&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Ladies Dancing refers to the nine Fruits of &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;the Holy Spirit&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Lords A-leaping refers to the ten &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;commandments&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Pipers Piping refers to the eleven &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;faithful apostles&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Drummers Drumming refers to the points of &quot;&lt;/span&gt;
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;doctrine in the Apostle&#39;s Creed&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        DoceDias doceDias &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; DoceDias&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        doceDias&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/8889708808057205777/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-529.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8889708808057205777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8889708808057205777'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-529.html' title='Como Programar en Java: Ejercicio 5.29'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-1128897722402587778</id><published>2011-10-01T17:31:00.000-05:00</published><updated>2011-10-01T17:31:50.348-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Como Programar en Java: Ejercicio 5.27</title><content type='html'>Aquí esta el ejercicio 5.27 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de simular una salida de un ciclo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; sin utilizar continue.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.27&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; NoContinue &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; cuenta &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; cuenta &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; cuenta&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;cuenta &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%d &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; cuenta&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Se uso continue para omitir imprimir 5&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/1128897722402587778/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-527.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1128897722402587778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1128897722402587778'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/10/como-programar-en-java-ejercicio-527.html' title='Como Programar en Java: Ejercicio 5.27'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-8333968341011657049</id><published>2011-09-29T20:03:00.000-05:00</published><updated>2011-09-29T20:03:53.179-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="do - while"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><title type='text'>Como Programar en Java: Ejercicio 5.26</title><content type='html'>Aquí esta el ejercicio 5.26 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de simular una salida de un ciclo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; sin utilizar break.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.26&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; NoBreak &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; cuenta &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            cuenta&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%d &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; cuenta&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;cuenta &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Salio del ciclo en cuenta = %d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; cuenta&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/8333968341011657049/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-526.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8333968341011657049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8333968341011657049'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-526.html' title='Como Programar en Java: Ejercicio 5.26'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-7384583574291799045</id><published>2011-09-27T22:23:00.000-05:00</published><updated>2011-09-27T22:23:25.439-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="New"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><title type='text'>Como Programar en Java: Ejercicio 5.25</title><content type='html'>Aquí esta el ejercicio 5.25 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir un Rombo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con asteriscos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.25&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; RomboTamano &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir un Rombo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con asteriscos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; numero int Con un numero impar&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; si no&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; fuera impar el metodo lo indicara.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numero&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;19&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Debe estar entre 1 y 19 el numero.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es un nÃºmero impar.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; media &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                            columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                                    &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                                    &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
                                    &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        RomboTamano rombo &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; RomboTamano&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme un nÃºmero impar: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        rombo&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/7384583574291799045/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-525.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/7384583574291799045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/7384583574291799045'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-525.html' title='Como Programar en Java: Ejercicio 5.25'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-8024989182510399149</id><published>2011-09-26T21:04:00.000-05:00</published><updated>2011-09-26T21:04:39.974-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="New"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><title type='text'>Como Programar en Java: Ejercicio 5.24</title><content type='html'>Aquí esta el ejercicio 5.24 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir un Rombo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con asteriscos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.24&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; Rombo &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir un Rombo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con asteriscos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; media &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                            &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                            &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;media &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; media&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        Rombo rombo &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Rombo&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        rombo&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/8024989182510399149/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-524.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8024989182510399149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8024989182510399149'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-524.html' title='Como Programar en Java: Ejercicio 5.24'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-752120985043316763</id><published>2011-09-25T22:19:00.000-05:00</published><updated>2011-09-25T22:19:58.871-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Leyes Morgan"/><category scheme="http://www.blogger.com/atom/ns#" term="New"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><title type='text'>Como Programar en Java: Ejercicio 5.23</title><content type='html'>Aquí esta el ejercicio 5.23 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de convertir las siguientes&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; expresiones utilizando leyes de Morgan.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; !( x &amp;lt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ) &amp;amp;&amp;amp; !( y &amp;gt;= &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; )&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; !( x == y ) || !( z != &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; )&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; !( ( x &amp;lt;= &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ) &amp;amp;&amp;amp; ( y &amp;gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ) )&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; !( ( x &amp;gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ) || ( y &amp;lt;= &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ) )&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.23&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; LeyesMorgan &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de convertir algunas condiciones&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con las leyes de morgan. Si se imprime alguna leyenda&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de no es cierto quiere decir que las leyes de Morgan&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; no fueron aplicadas correctamente.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; x int Con el primer entero introducido.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; y int Con el segundo entero introducido.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; z int Con el tercer entero introducido.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; x&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; y&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; z&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es cierto 1&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;


         &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; y&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;z &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                 &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; y&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;z &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
             &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es cierto 2&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
         &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

         &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                 &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
             &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es cierto 3&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
         &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
         &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                 &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
             &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es cierto 4&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
         &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        LeyesMorgan leyes &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; LeyesMorgan&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; x &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; x &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; x&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; y &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; y &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; y&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; z &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; z &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; z&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    leyes&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; y&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; z&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/752120985043316763/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-523.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/752120985043316763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/752120985043316763'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-523.html' title='Como Programar en Java: Ejercicio 5.23'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-6741111220350221014</id><published>2011-09-24T14:44:00.000-05:00</published><updated>2011-09-24T14:44:12.037-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><title type='text'>Como Programar en Java: Ejercicio 5.22</title><content type='html'>Aquí esta el ejercicio 5.22 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir diferentes patrones utilizando&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; seguidos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.22&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; ImprimirAsteriscosAstutos &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; diferentes patrones.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimirPatrones&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;55&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;40&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;40&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;45&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;45&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        ImprimirAsteriscosAstutos asteriscos &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; ImprimirAsteriscosAstutos&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        asteriscos&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimirPatrones&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/6741111220350221014/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-522.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6741111220350221014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6741111220350221014'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-522.html' title='Como Programar en Java: Ejercicio 5.22'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-6888483536125269304</id><published>2011-09-24T14:43:00.000-05:00</published><updated>2011-09-24T14:43:09.089-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Integer"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><category scheme="http://www.blogger.com/atom/ns#" term="void"/><title type='text'>Como Programar en Java: Ejercicio 5.21</title><content type='html'>Aquí esta el ejercicio 5.21 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de calcular los Triples de Pitagoras.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.21&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; TriplesPitagoras &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de calcular los Triples de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Pitagoras por fuerza bruta en longitudes que van&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; desde &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; hasta &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; unidades.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene la suma de los cuadrados de los dos lados&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de un triangulo.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; sumaLados &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el total de triples de pitagoras.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; lado1 &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; lado1 &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; lado1&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; lado2 &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; lado2 &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; lado2&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; hipotenusa &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; hipotenusa &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; hipotenusa&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    sumaLados &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;lado1 &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; lado1&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;lado2 &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; lado2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;hipotenusa &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; hipotenusa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; sumaLados&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Triples de pitÃ¡goras con:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;
                                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Lado 1: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; lado1
                                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Lado 2: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; lado2
                                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Hipotenusa: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; hipotenusa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                        contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Existen un total de &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; contador
                    &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot; triples de pitÃ¡goras.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        TriplesPitagoras triplesPitagoras &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; TriplesPitagoras&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        triplesPitagoras&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/6888483536125269304/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-521.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6888483536125269304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6888483536125269304'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-521.html' title='Como Programar en Java: Ejercicio 5.21'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-9015759536613351211</id><published>2011-09-22T21:07:00.000-05:00</published><updated>2011-09-22T21:07:36.010-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="double"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><title type='text'>Como Programar en Java: Ejercicio 5.20</title><content type='html'>Aquí esta el ejercicio 5.20 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de calcular aproximaciones&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; al nÃºmero PI.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.20&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; AproximacionesPI &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de calcular als aproximaciones&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a la constante matematica PI.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; terminos int con el numero de terminos a&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; calcular.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@return&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; resultado double con la aproximacion a PI.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; aproximar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; terminos&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; resultado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;4.0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; terminos&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;4.0&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                            &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;pow&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; resultado&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        AproximacionesPI pi &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; AproximacionesPI&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9999&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%05d  %20.15f&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
                    contador&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; pi&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;aproximar&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/9015759536613351211/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-520.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/9015759536613351211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/9015759536613351211'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-520.html' title='Como Programar en Java: Ejercicio 5.20'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-6044597717801120004</id><published>2011-09-22T21:00:00.000-05:00</published><updated>2011-09-22T21:00:27.613-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="do - while"/><category scheme="http://www.blogger.com/atom/ns#" term="double"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><category scheme="http://www.blogger.com/atom/ns#" term="switch"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 5.17</title><content type='html'>Aquí esta el ejercicio 5.17 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de calcular el valor total de venta&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de todos los productos vendidos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.17&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; Almacen &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargad de calcular el valor total de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; venta de todos los productos vendidos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@return&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; resultado double con el total de la venta.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el total de la venta.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; resultado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;0.0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el numero del producto.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numeroProducto &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme el numero del producto: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            numeroProducto &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;switch&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numeroProducto&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;2.98&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;4.5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;9.98&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;4.49&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;6.87&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;No es un producto valido&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numeroProducto &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; resultado&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de verificar que la cantidad que&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; da el usuario sea mayor a cero.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@return&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; cantidad int con la cantidad validada.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; cantidad&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene la cantidad que se vendio de un producto.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; cantidad &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme la cantidad vendida del producto: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            cantidad &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;cantidad &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; cantidad&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Escriba una cantidad mayor a cero.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracteristicas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        Almacen almacen &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Almacen&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//%.2f indica que espera un double y que tendra en el area de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//decimales solo dos digitos.&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;El total de ventas es: %.2f&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; almacen&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcular&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/6044597717801120004/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-517.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6044597717801120004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6044597717801120004'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-517.html' title='Como Programar en Java: Ejercicio 5.17'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-8853478714707069681</id><published>2011-09-21T20:22:00.000-05:00</published><updated>2011-09-21T20:22:05.088-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="do - while"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Integer"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><category scheme="http://www.blogger.com/atom/ns#" term="void"/><title type='text'>Como Programar en Java: Ejercicio 5.16</title><content type='html'>Aquí esta el ejercicio 5.16 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir barras horizontales.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.16&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; BarrasHorizontales &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir una barra horizontal&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; numeroAsteriscos int con el nÃºmero de asteriscos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a imprimir.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numeroAsteriscos&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numeroAsteriscos&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        BarrasHorizontales barras &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; BarrasHorizontales&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el contador para el ciclo.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el numero ingresado por el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numeroAsteriscos &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme el primer numero: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            numeroAsteriscos &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numeroAsteriscos &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; numeroAsteriscos &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                barras&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimir&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numeroAsteriscos&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Ingrese un numero entre 1 y 30&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/8853478714707069681/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-516.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8853478714707069681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/8853478714707069681'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-516.html' title='Como Programar en Java: Ejercicio 5.16'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-1453362652682028137</id><published>2011-09-21T20:20:00.000-05:00</published><updated>2011-09-21T20:20:32.828-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="Integer"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="void"/><title type='text'>Como Programar en Java: Ejercicio 5.18</title><content type='html'>Aquí esta el ejercicio 5.18 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase que calcula el interes compuesto.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.18&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;Deitel - Base tomada de su libro.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; InteresCompuestoEnteros &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
     &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Monto que se deposita al final del periodo &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aÃ±o&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; monto&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Monto inicial los dos ultimos son los decimales&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; principal &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100000&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; La tasa de interÃ©s.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; tasa&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;tasa &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; tasa &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; tasa&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Con tasa de interes del &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; tasa &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se muestra el encabezado de la tabla.&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%s%20s&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Anio&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Monto en deposito&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: dimgrey;&quot;&gt;//calcula el monto en deposito para cada uno de diez aÃ±os&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; anio &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; anio &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; anio&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: dimgrey;&quot;&gt;//calcula el nuevo monto para el aÃ±o especificado&lt;/span&gt;
                monto &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;principal &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;pow&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;1.0&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;tasa &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; anio&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

                &lt;span style=&quot;color: dimgrey;&quot;&gt;// muestra el aÃ±o y el monto&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%4d%,17d.%02d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
                        anio&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; monto &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; monto &lt;span style=&quot;color: #808030;&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/1453362652682028137/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-518.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1453362652682028137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/1453362652682028137'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-518.html' title='Como Programar en Java: Ejercicio 5.18'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-6381228859964620599</id><published>2011-09-19T20:13:00.000-05:00</published><updated>2011-09-19T20:13:04.603-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><title type='text'>Como Programar en Java: Ejercicio 5.15</title><content type='html'>Aquí esta el ejercicio 5.15 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir diferentes patrones utilizando&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; solamente&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; System&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;print(&#39;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&#39;)&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; System&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;println()&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Esta instruccion solo se utiliza para los dos ultimos patrones.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; System&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;print(&#39; &#39;)&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.15&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; ImprimirAsteriscos &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de imprimir &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; diferentes patrones.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimirPatrones&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Imprime el patron (a)&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; renglon&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Imprime el patron (b)&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; renglon&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Imprime el patron (c)&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Imprime el patron (d)&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; renglon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;*&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        ImprimirAsteriscos asteriscos &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; ImprimirAsteriscos&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        asteriscos&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimirPatrones&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/6381228859964620599/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-515.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6381228859964620599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6381228859964620599'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-515.html' title='Como Programar en Java: Ejercicio 5.15'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-5346312372791967288</id><published>2011-09-19T20:10:00.000-05:00</published><updated>2011-09-19T20:10:10.970-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="double"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><title type='text'>Como Programar en Java: Ejercicio 5.14</title><content type='html'>Aquí esta el ejercicio 5.14 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase que calcula el interes compuesto.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.14&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;Deitel - Base tomada de su libro.&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; InteresCompuesto &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Monto que se deposita al final del periodo &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aÃ±o&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; monto&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Monto inicial&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; principal &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;1000.0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; La tasa de interÃ©s.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;double&lt;/span&gt; tasa&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;tasa &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; tasa &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; tasa&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Con tasa de interes del &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; tasa &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se muestra el encabezado de la tabla.&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%s%20s&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Anio&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Monto en deposito&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: dimgrey;&quot;&gt;//calcula el monto en deposito para cada uno de diez aÃ±os&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; anio &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; anio &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; anio&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: dimgrey;&quot;&gt;//calcula el nuevo monto para el aÃ±o especificado&lt;/span&gt;
                monto &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; principal &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;pow&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;1.0&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;tasa &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; anio&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

                &lt;span style=&quot;color: dimgrey;&quot;&gt;// muestra el aÃ±o y el monto&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;%4d%,20.2f&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; anio&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; monto&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;printf&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/5346312372791967288/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-514.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5346312372791967288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5346312372791967288'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-514.html' title='Como Programar en Java: Ejercicio 5.14'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-4498154017097008916</id><published>2011-09-18T21:24:00.000-05:00</published><updated>2011-09-18T21:24:55.438-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="void"/><title type='text'>Como Programar en Java: Ejercicio 5.12</title><content type='html'>Aquí esta el ejercicio 5.12 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase que calcula el producto de los nÃºmeros impares del &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; al &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.12&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; ProductoImpares &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de calcular el producto de los nÃºmeros impares&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; que estÃ¡n presentes del &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; al &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; calcularProducto&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; resultado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; contador&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;El producto de los nÃºmeros impares es: &quot;&lt;/span&gt;
                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; resultado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        ProductoImpares productoImpares &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; ProductoImpares&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        productoImpares&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcularProducto&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/4498154017097008916/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-512.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/4498154017097008916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/4498154017097008916'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-512.html' title='Como Programar en Java: Ejercicio 5.12'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-2737482975577114426</id><published>2011-09-17T16:22:00.000-05:00</published><updated>2011-09-17T16:22:39.021-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="main"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><title type='text'>Como Programar en Java: Ejercicio 5.13</title><content type='html'>Aquí esta el ejercicio 5.13 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de calcular el factorial.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.13&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; Factorial &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de calcular el factorial de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; un nÃºmero positivo utilizando un mÃ©todo iterativo.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Si se ingresa un nÃºmero negativo regresara un &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; como&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; resultado.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entero int Con el entero a calcular su factorial.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@return&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; resultado int Con el factorial calculado.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; calcularFactorial&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; entero&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el contador utilizado como condiciÃ³n en el&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; ciclo while para calcular su factorial.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Almacena el resultado del factorial&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; por ser multiplicaciones&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; lo que se utilizara se inicializa en &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; resultado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;entero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Las tres partes del ciclo se encuentran&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//separadas por ; (punto y coma). La primer&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//parte del ciclo especifica valores previo&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//a su inicio. La segunda parte indica la&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//condiciÃ³n de terminaciÃ³n para el ciclo,&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//la cual esta directamente relacionada con&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//los valores iniciales. Finalmente, la&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Ãºltima parte especifica como serÃ¡n&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//manipulados los valores iniciales en cada&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//iteraciÃ³n del ciclo. Cada parte del ciclo&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//debe incluir al menos un elemento, a la&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//cual es posible agregar otros elementos a&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//partir de una , (coma).&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                resultado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; resultado &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; contador&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; resultado&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        Factorial factorial &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Factorial&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Las tres partes del ciclo se encuentran&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//separadas por ; (punto y coma). La primer&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//parte del ciclo especifica valores previo&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//a su inicio. La segunda parte indica la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//condiciÃ³n de terminaciÃ³n para el ciclo,&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//la cual esta directamente relacionada con&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//los valores iniciales. Finalmente, la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Ãºltima parte especifica como serÃ¡n&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//manipulados los valores iniciales en cada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//iteraciÃ³n del ciclo. Cada parte del ciclo&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//debe incluir al menos un elemento, a la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//cual es posible agregar otros elementos a&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//partir de una , (coma).&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;    &quot;&lt;/span&gt;
                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; factorial&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcularFactorial&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/2737482975577114426/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-513.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/2737482975577114426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/2737482975577114426'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-513.html' title='Como Programar en Java: Ejercicio 5.13'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-6512216997559311830</id><published>2011-09-14T19:20:00.000-05:00</published><updated>2011-09-14T19:20:50.896-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Deitel"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="final"/><category scheme="http://www.blogger.com/atom/ns#" term="For"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Modulo"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="static. new"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><title type='text'>Como Programar en Java: Ejercicio 5.11</title><content type='html'>Aquí esta el ejercicio 5.11 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase que encuentra el menor de varios enteros.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.11&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; MenorEntero &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de obtener el menor de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; los enteros&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el primer entero introducido&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; serÃ¡ el numero de enteros que se permiten&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; introducir.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; encontrarMenor&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme el nÃºmero de enteros que introducira&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numeroDeEnteros &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; menor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numeroDeEnteros&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme un entero: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Si es el primer nÃºmero introducido&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//el menor serÃ¡ este.&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                menor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Si el numero es menor al menor entonces&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//menor sera el numero.&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; menor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                menor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;El menor es: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; menor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        MenorEntero menorEntero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; MenorEntero&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        menorEntero&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;encontrarMenor&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/6512216997559311830/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-511.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6512216997559311830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/6512216997559311830'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-511.html' title='Como Programar en Java: Ejercicio 5.11'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-3788533595390479239</id><published>2011-09-13T21:34:00.000-05:00</published><updated>2011-09-13T21:34:51.471-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="final"/><category scheme="http://www.blogger.com/atom/ns#" term="Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="JPanel"/><category scheme="http://www.blogger.com/atom/ns#" term="Modulo"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="PaintComponent"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><title type='text'>Como Programar en Java: Ejercicio 5.2</title><content type='html'>Aquí esta el ejercicio 5.2 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: dimgrey;&quot;&gt;/*&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;&amp;nbsp;* Paquete que contiene los ejercicios respecto&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;&amp;nbsp;* al capitulo cinco de Como Programar en Java Septima Edicion.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;awt&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Graphics&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; javax&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;swing&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;JFrame&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; javax&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;swing&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;JOptionPane&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; javax&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;swing&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;JPanel&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir rectÃ¡ngulos de distintos tamaÃ±os dependiendo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de la cantidad que el usuario ingrese.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.2&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; Barras &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;extends&lt;/span&gt; JPanel &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Las clases que implementan este interfaz son susceptibles de ser&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; serializadas (es decir&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; las instancias de estas clases pueden&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; guardarse y leerse en&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;de disco &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;o cualquier otro dispositivo de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entrada&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;salida&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;). Al serializar lo que sucede es que los atributos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; del objeto se convierten en cadenas de bytes y se guardan en el&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; disco. Para leer un objeto&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; se leen las cadenas de bytes y se&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; reconstruye el objeto a partir de ellos. Imagina que tienes una&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aplicaciÃ³n que serializa en disco una serie de objetos al cerrarse&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; y los lee en la siguiente ejecuciÃ³n para mantener los valores que&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; tenÃ­an antes. El campo serialVersionUID es el nÃºmero de versiÃ³n de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; la clase. Cuando el objeto es serializado lo primero que hace es&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; escribir el serialVersionUID. Si al leer el objeto se detecta que&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el valor del serialVersionUID guardado no coincide con el actual se&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; lanza una exception InvalidClassException&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de modo que el programador&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; puede tratar la excepciÃ³n de manera adecuada. Para que este mecanismo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; funcione bien&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el programador debe proveer el campo private static&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; final long serialVersionUID en todas las clases que implementen&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Serializable y en todas las subclases de ellas. El valor es&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; indiferente&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pero debes actualizarlo cada vez que modificas tu  clase&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aÃ±adiendo o quitando atributos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;long&lt;/span&gt; serialVersionUID &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #006600;&quot;&gt;L&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; tamano &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Constructor de Barras.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; tamano int Tamaño de la barra.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; Barras&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; tamano&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;tamano &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; tamano&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de pintar cÃ­rculos concÃ©ntricos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a partir del centro del JPanel con radios mayores de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pixeles en &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pixeles.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; g Objeto Graphics encapsula la informaciÃ³n de estado&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; necesaria para realizar las operaciones bÃ¡sicas que soporta&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Java&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; paintComponent&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Graphics&lt;/span&gt; g&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;paintComponent&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;g&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        g&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;drawRect&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tamano&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Obtiene el tamaño del rectángulo.&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt; entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; JOptionPane&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;showInputDialog&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Tamaño del rectángulo: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Convierte la entrada en un int.&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; tamano &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;parseInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;entrada&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definición de la clase.&lt;/span&gt;
        Barras barras &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Barras&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;tamano&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Crea un nuevo objeto JFrame&lt;/span&gt;
        JFrame aplicacion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; JFrame&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Indicamos que la operacion default para&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//cerrar sera EXIT_ON_CLOSE&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setDefaultCloseOperation&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;JFrame&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;EXIT_ON_CLOSE&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Agregando el panel al marco&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;add&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;barras&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Establece el tamaÃ±o del marco&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setSize&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Poniendo su propiedad Visible en verdadera&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setVisible&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/3788533595390479239/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-52.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/3788533595390479239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/3788533595390479239'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-52.html' title='Como Programar en Java: Ejercicio 5.2'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-5152322245950591261</id><published>2011-09-12T19:49:00.000-05:00</published><updated>2011-09-12T19:49:28.074-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="final"/><category scheme="http://www.blogger.com/atom/ns#" term="Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="JPanel"/><category scheme="http://www.blogger.com/atom/ns#" term="Modulo"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="PaintComponent"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><title type='text'>Como Programar en Java: Ejercicio 5.1</title><content type='html'>Aquí esta el ejercicio 5.1 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulocinco&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;awt&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Graphics&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; javax&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;swing&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;JFrame&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; javax&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;swing&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;JPanel&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de pintar &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; circulos concÃ©ntricos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5.1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; CirculosDiez &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;extends&lt;/span&gt; JPanel &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Las clases que implementan este interfaz son susceptibles de ser&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; serializadas (es decir&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; las instancias de estas clases pueden&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; guardarse y leerse en&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;de disco &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;o cualquier otro dispositivo de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; entrada&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;salida&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;). Al serializar lo que sucede es que los atributos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; del objeto se convierten en cadenas de bytes y se guardan en el&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; disco. Para leer un objeto&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; se leen las cadenas de bytes y se&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; reconstruye el objeto a partir de ellos. Imagina que tienes una&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aplicaciÃ³n que serializa en disco una serie de objetos al cerrarse&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; y los lee en la siguiente ejecuciÃ³n para mantener los valores que&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; tenÃ­an antes. El campo serialVersionUID es el nÃºmero de versiÃ³n de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; la clase. Cuando el objeto es serializado lo primero que hace es&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; escribir el serialVersionUID. Si al leer el objeto se detecta que&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el valor del serialVersionUID guardado no coincide con el actual se&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; lanza una exception InvalidClassException&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de modo que el programador&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; puede tratar la excepciÃ³n de manera adecuada. Para que este mecanismo&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; funcione bien&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el programador debe proveer el campo private static&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; final long serialVersionUID en todas las clases que implementen&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Serializable y en todas las subclases de ellas. El valor es&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; indiferente&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pero debes actualizarlo cada vez que modificas tu  clase&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; aÃ±adiendo o quitando atributos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;long&lt;/span&gt; serialVersionUID &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #006600;&quot;&gt;L&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; ITERACIONES &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; LADO_CUADRADO &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; DESPLAZAMIENTO &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; MÃ©todo encargado de pintar circulos concÃ©ntricos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; a partir del centro del JPanel con radios mayores de&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pixeles en &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; pixeles.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; g Objeto Graphics encapsula la informaciÃ³n de estado&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; necesaria para realizar las operaciones basicas que soporta&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Java&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; paintComponent&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;Graphics&lt;/span&gt; g&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;paintComponent&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;g&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Obteniendo el ancho&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; ancho &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; getWidth&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Obteniendo la altura&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; altura &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; getHeight&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Ciclo para pintar 10 circulos&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; ITERACIONES&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//El punto centrico en x menos 5x(i+1) unidades&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//El punto centrico en y menos 5x(i+1) unidades&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Esto para ir desplazando las esquinas de los&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//rectangulos que conformar el circulo del centro&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//hacia la esquina superior izquierda y el larcho&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//y ancho lo vamos incrementando.&lt;/span&gt;
            g&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;drawOval&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ancho &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;DESPLAZAMIENTO &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
                    altura &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;DESPLAZAMIENTO &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
                    LADO_CUADRADO &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; LADO_CUADRADO&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
                    LADO_CUADRADO &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; LADO_CUADRADO&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicaciÃ³n.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las caracterÃ­sticas&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene segÃºn la definiciÃ³n de la clase.&lt;/span&gt;
        CirculosDiez panel &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; CirculosDiez&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Crea un nuevo objeto JFrame&lt;/span&gt;
        JFrame aplicacion &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; JFrame&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Indicamos que la operacion default para&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//cerrar sera EXIT_ON_CLOSE&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setDefaultCloseOperation&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;JFrame&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;EXIT_ON_CLOSE&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Agregando el panel al marco&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;add&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;panel&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Establece el tamaÃ±o del marco&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setSize&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Poniendo su propiedad Visible en verdadera&lt;/span&gt;
        aplicacion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;setVisible&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/5152322245950591261/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-51.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5152322245950591261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/5152322245950591261'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-51.html' title='Como Programar en Java: Ejercicio 5.1'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-388622641727288194</id><published>2011-09-11T19:31:00.000-05:00</published><updated>2011-09-11T19:31:02.120-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 2.29</title><content type='html'>Aquí esta el ejercicio 4.29 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulo4&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de imprimir cuadrados&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; huevos con un lado mayor o igual a &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; unidad&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; y menor o igual a &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; unidades.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4.29&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; Cuadrado &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de imprimir cuadrados huecos&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; con tamaño de sus lados de &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; unidades.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; imprimirCuadrado&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Deme el lado del cuadrado: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; lado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;lado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;lado &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//En el caso del ciclo while: Primero se evalúa &lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//la condición de entrada si es verdadera ejecuta &lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//las sentencias en su cuerpo, luego vuelve a&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//verificar la condición de entrada y hasta que &lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//sea falsa sale del ciclo.&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; lado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; lado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;renglon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; lado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;columna &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; lado&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                    columna&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                renglon&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;El tamaño no se puede procesar.&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        Cuadrado cuadrado &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Cuadrado&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        cuadrado&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;imprimirCuadrado&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/388622641727288194/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-229.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/388622641727288194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/388622641727288194'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-229.html' title='Como Programar en Java: Ejercicio 2.29'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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-4589601546169459793.post-3801419586940040003</id><published>2011-09-10T20:04:00.000-05:00</published><updated>2011-09-10T20:04:14.069-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="if-else"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 4.23</title><content type='html'>Aquí esta el ejercicio 4.23 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulo4&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de obtener los dos enteros más grandes&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de un conjunto de &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; enteros.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4.23&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; DosMasGrandes &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de obtener los dos enteros mas&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; grandes de un conjunto de &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; enteros.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; calcularGrandes&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el contador del ciclo while.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el entero introducido por el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el mayor de los enteros introducidos por&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; mayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el segundo entero mayor de los enteros&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; introducidos por el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; segundoMayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//En el caso del ciclo while: Primero se evalúa la condición &lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de entrada si es verdadera ejecuta las sentencias en su&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//cuerpo, luego vuelve a verificar la condición de entrada &lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//y hasta que sea falsa sale del ciclo.&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Dame un entero: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: dimgrey;&quot;&gt;//Si entra en numero &amp;gt; mayor inmediatamente el segundoMayor&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//se le asigna lo que tenía el mayor puesto que este deja de&lt;/span&gt;
            &lt;span style=&quot;color: dimgrey;&quot;&gt;//ser el mayor.&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; mayor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                segundoMayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mayor&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                mayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; segundoMayor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                segundoMayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;El entero más grande es: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; mayor
                &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot; y el segundo más grande es: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; segundoMayor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        DosMasGrandes dosMasGrandes &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; DosMasGrandes&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        dosMasGrandes&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;calcularGrandes&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/3801419586940040003/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-423.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/3801419586940040003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/3801419586940040003'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-423.html' title='Como Programar en Java: Ejercicio 4.23'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4589601546169459793.post-7745752217674463654</id><published>2011-09-10T19:57:00.000-05:00</published><updated>2011-09-10T19:57:07.954-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Como Programar en Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Ejercicio"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Out"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Printf"/><category scheme="http://www.blogger.com/atom/ns#" term="Println"/><category scheme="http://www.blogger.com/atom/ns#" term="Scanner"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="While"/><title type='text'>Como Programar en Java: Ejercicio 4.21</title><content type='html'>Aquí esta el ejercicio 4.21 de Como Programar en Java séptima edición.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;package&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; com&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;jlm&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ccb&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;ejercicios&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;capitulo4&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; java&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;Scanner&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Clase encargada de buscar el entero más grande de &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; enteros&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; introducidos por el usuario.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Ejercicio &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4.21&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;LorettoTG&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@version&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; ElMasGrande &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Método encargado de recibir &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; enteros y buscar el mayor&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; de ellos.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; buscarMayor&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el contador del ciclo while&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; contador &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el entero introducido por el usuario&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Contiene el mayor de los enteros introducidos por&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; el usuario&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
        &lt;span style=&quot;color: #bb7977;&quot;&gt;int&lt;/span&gt; mayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//Se crea un objeto Scanner para obtener la entrada&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de datos del usuario.&lt;/span&gt;
        Scanner entrada &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; Scanner&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;in&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;//En el caso del ciclo while: Primero se evalúa &lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//la condición de entrada si es verdadera ejecuta las &lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//sentencias en su cuerpo, luego vuelve a verificar la &lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//condición de entrada y hasta que sea falsa sale del ciclo.&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;contador &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Dame un entero: &quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            numero &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; entrada&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;nextInt&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;numero &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; mayor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                mayor &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; numero&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            contador&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;out&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;println&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;El entero más grande es: &quot;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt; mayor&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #3f5fbf;&quot;&gt;/**&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; Punto de entrada a la clase y a la aplicación.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-weight: bold;&quot;&gt;@param&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf;&quot;&gt; args matriz de argumentos de cadena.&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #bb7977;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #bb7977; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; args&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//El operador new es el encargado de crear instancias de&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//una clase, es decir los objetos que tienen las características&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//de la clase. El operador new de Java es capaz de reservar la&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//memoria para un objeto de este tipo sabiendo los atributos que&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//tiene según la definición de la clase.&lt;/span&gt;
        ElMasGrande elMasGrande &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; ElMasGrande&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        elMasGrande&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;buscarMayor&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://cenandoconbytes.blogspot.com/feeds/7745752217674463654/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-421.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/7745752217674463654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4589601546169459793/posts/default/7745752217674463654'/><link rel='alternate' type='text/html' href='http://cenandoconbytes.blogspot.com/2011/09/como-programar-en-java-ejercicio-421.html' title='Como Programar en Java: Ejercicio 4.21'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/03233651474470198403</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></feed>