tag:blogger.com,1999:blog-66207926180429068432024-03-13T13:15:12.632-07:00programacion dirigida por eventosAnonymoushttp://www.blogger.com/profile/09718651242233265632noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6620792618042906843.post-10249430375801643922013-05-17T14:00:00.001-07:002014-05-13T09:14:33.909-07:00plantas vs zombies <div class="FanDeJuegos_Game" style="height: 470px; width: 480px;">
Cargando <a href="http://www.fandejuegos.com/" target="_blank">juegos</a>:3913
</div>
<!-- Coloca esta petición Javascript una sola vez donde creas oportuno. -->
<script type="text/javascript">
//<![CDATA[
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'http://api.fandejuegos.com/API.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
//]]>
</script>Anonymoushttp://www.blogger.com/profile/09718651242233265632noreply@blogger.com0tag:blogger.com,1999:blog-6620792618042906843.post-66031503351986263882013-05-06T10:54:00.000-07:002013-05-30T17:50:42.493-07:00ejemplo<h2>
ejemplo calculadora simple</h2>
<div>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white; font-family: Arial, sans-serif; font-size: 13.5pt;">Visualmente
nuestra calculadora en su versión más básica tendrá el siguiente aspecto:<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl6eONZHNKj5Fj4KM2i-yIvJRCPgOT0EKRAnOlI2j7R9UhFfN3OsPPAKtkoCebbeL-hqwMEKOVDjPSrwjF37KIemewse7DHA-lZlI-5DKMNheLvKEvlagTQhXCoWTQ5BEVGrOq0GQh6GTl/s1600/cal.png" imageanchor="1" style="background-color: white; margin-left: 1em; margin-right: 1em;"><img border="0" height="22" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl6eONZHNKj5Fj4KM2i-yIvJRCPgOT0EKRAnOlI2j7R9UhFfN3OsPPAKtkoCebbeL-hqwMEKOVDjPSrwjF37KIemewse7DHA-lZlI-5DKMNheLvKEvlagTQhXCoWTQ5BEVGrOq0GQh6GTl/s1600/cal.png" width="320" /></a></div>
<div class="separator" style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;">/** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * importacion de la clase Scanner para capturar datos por teclado. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;">import java.util.Scanner; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;">/** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * calculadora que hace operaciones matematicas simples con el </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * ultimo numero que va quedando del ultimo calculo. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * @author Jose Fernando </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;">public class Calculadora { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * en este orden cada variable(atributo) se refiere a: </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * numero a ingresar. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * resultado acumulado. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * operacion a realizar. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> private int numIn; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> private int acum; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> private int opc; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * constructor para inicializar los atributos. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> public Calculadora() </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> numIn = 0; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum = 0; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> opc = 0; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> private void proceso() </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * objeto que permite ingresar datos por teclado. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> Scanner ent = new Scanner(System.in); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * contador nesesario para indicarle al programa que </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * apenas se va a realizar la primera operacion. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> int i=0; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * bucle for sin parametros, aunque se ubiera podido </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * usar mejor un blucle do while o un bucle while. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> for(;;) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * en caso de que i sea igual a 0 acum es </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * igual al primer numero ingresado. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> if(i == 0) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print("ingrese un numero ==> "); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum = ent.nextInt(); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * seleccione que operacion va a realizar, si no </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * elige un valor entre 1 y 4 el programa termina. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print("ingrese la operacion a realizarn" + </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> "1 => +, 2 => -, 3 => *, 4 => /, otro numero => salir. ==> "); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> opc = ent.nextInt(); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * el bucle termina si no se elige un valor entre 1 y 4. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> if(opc < 1 || opc > 4) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> break; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * //ingresar un numero por teclado para continuar la opercacion. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print("ingrese el siguiente numero ==> "); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> numIn = ent.nextInt(); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * se llama al metodo operacion que es el que hace los calculos </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * dependiendo de la opc elegida que es ingresada como parametro. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> this.operacion(opc); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * muestra el resultado por pantalla. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print(" = " + acum + "nn"); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * contador. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> i++; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.println("Proceso terminado"); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.exit(0); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> private void operacion(int opc) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * con un switch se selecciona la operacion requerida, + - x / </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * y se muestra la operacion en pantalla. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> switch(opc) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> case 1: </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print(acum + " + " + numIn); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum += numIn; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> break; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> case 2: </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print(acum + " - " + numIn); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum -= numIn; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> break; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> case 3: </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print(acum + " X " + numIn); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum *= numIn; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> break; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> case 4: </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> System.out.print(acum + " / " + numIn); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> acum /= numIn; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> break; </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> public static void main(String[] args) </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> { </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> /** </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> * se instancia la clase Calculadora para ejecutar el programa. </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> */ </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> Calculadora calc = new Calculadora(); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> calc.proceso(); </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;"> } </span><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><br style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px; outline: none 0px;" /><span style="background-color: white; font-family: Console, 'Courier New', 'lucida console', monospace; font-size: 12px; font-style: italic; font-weight: bold; line-height: 17px;">} </span></div>
</div>
Anonymoushttp://www.blogger.com/profile/09718651242233265632noreply@blogger.com2tag:blogger.com,1999:blog-6620792618042906843.post-11397517136090373172013-05-06T10:06:00.000-07:002013-05-17T13:32:19.767-07:00multi tarea<h2>
multitarea...</h2>
<div>
<div style="text-align: justify;">
</div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Arial, sans-serif; font-size: 13.5pt;"><br /></span>
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Arial, sans-serif; font-size: 13.5pt;"><span style="background-color: white;"><span style="font-family: Arial, sans-serif; font-size: 13.5pt;"><br />
Es la característica de los sistemas operativos modernos de permitir que varios
procesos sean ejecutados </span><span style="background-position: initial initial; background-repeat: initial initial; color: #333333; font-family: Arial, sans-serif; font-size: 13.5pt;">al mismo tiempo,
compartiendo uno o más procesadores.</span><span style="font-family: Arial, sans-serif; font-size: 13.5pt;"><o:p></o:p></span></span></span></div>
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Arial, sans-serif; font-size: 13.5pt;">
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="background-color: white;"><span style="font-family: Arial, sans-serif; font-size: 13.5pt;">Los procesos de usuario son quienes ceden la CPU al sistema
operativo a intervalos regulares. Muy problemática, puesto que si el proceso de
usuario se interrumpe y no cede la CPU al sistema operativo, todo el sistema
estará trabado, es decir, sin poder hacer nada.</span><span style="font-family: Arial, sans-serif; font-size: 13.5pt;"><o:p></o:p></span></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
<span style="font-family: Arial, sans-serif; font-size: 13.5pt;"><span style="background-color: white;">Los sistemas operativos multitarea son capaces de dar
servicio a más de un proceso a la vez permitiendo la ejecución de muchos más
programas.<br />
En esta categoría también se encuentran todos los sistemas que cumplen
simultáneamente las necesidades de dos o más usuarios (llamados sistemas
multiusuario), que comparten mismos recursos. Este tipo de sistemas se emplean
especialmente en redes. En otras palabras consiste en el fraccionamiento del
tiempo (“timesharing” en inglés).</span><span style="background-color: white;"><o:p></o:p></span></span></div>
</span></div>
</div>
<div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; line-height: 10.5pt; margin-bottom: 2.25pt;">
<span style="color: #333333; font-family: "Tahoma","sans-serif"; font-size: 10.0pt; mso-bidi-font-size: 8.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: ES-MX;"><span style="background-color: white;"><o:p></o:p></span></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/09718651242233265632noreply@blogger.com3tag:blogger.com,1999:blog-6620792618042906843.post-29369682051611973462013-05-04T18:04:00.001-07:002013-05-30T17:44:30.284-07:00Eventos secuenciales, simultaneos y congruentes<h2>
<span class="PageTitle" style="background-color: white; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size: large;"><span style="line-height: 32px;">Eventos secuenciales, simultáneos y congruentes</span></span><span style="background-color: white; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal;"></span><div style="background-color: white; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal;">
<div class="ButtonPosition" style="position: absolute; right: 0px; top: 0px;">
</div>
</div>
</h2>
<div class="_kso fsm direction_ltr _55r0" data-jsid="message" style="background-color: white; direction: ltr; margin-bottom: 3px; word-wrap: break-word;">
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif;">
</span></div>
<div class="MsoNormal" style="margin-bottom: 2.5pt;">
</div>
<br />
<div style="text-align: justify;">
<br /></div>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span>
<br />
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span style="color: #333333; font-family: Arial, sans-serif; font-size: 13.5pt; white-space: pre-wrap;"><o:p></o:p></span>
<div class="MsoNormal" style="margin-bottom: 2.5pt;">
<span style="color: #333333; font-family: Arial, sans-serif; font-size: 13.5pt; white-space: pre-wrap;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: 13.5pt;">Los
eventos secuenciales son una forma de programación también conocida como
programación dirigida por eventos, esto es un paradigma de programación en el
que tanto la estructura como la ejecución de los programas van determinados por
los sucesos que ocurran en el sistema, definidos por el usuario o que ellos
mismos provoquen.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: 13.5pt;">Para
entender la programación dirigida por eventos, podemos oponerla a lo que no es:
mientras en la programación secuencial (o estructurada) es el programador el
que define cuál va a ser el flujo del programa, en la programación dirigida por
eventos será el propio usuario —o lo que sea que esté accionando el programa—
el que dirija el flujo del programa.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: 13.5pt;"> Aunque
en la programación secuencial puede haber intervención de un agente externo al
programa, estas intervenciones ocurrirán cuando el programador lo haya
determinado, y no en cualquier momento como puede ser en el caso de la
programación dirigida por eventos.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<u1:p></u1:p>
<u1:p></u1:p>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: 13.5pt;">El
creador de un programa dirigido por eventos debe definir los eventos que
manejarán su programa y las acciones que se realizarán al producirse cada uno
de ellos, lo que se conoce como el administrador de event Los eventos
soportados estarán determinados por el lenguaje de programación utilizado, por
el sistema operativo e incluso por eventos creados por el mismo programador.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Los procesos concurrentes tienen las siguientes<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Características:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">• Son programas que tienen múltiples líneas de flujo de control.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">• Las sentencias de un programa concurrente se ejecutan de<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">acuerdo con un orden no estricto.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">In determinismo: Las acciones que se especifican en un<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">programa secuencial tienen un orden total, pero en un<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">programa concurrente el orden es parcial, ya que existe<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">una incertidumbre sobre el orden exacto de ocurrencia<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">de ciertos sucesos, esto es, existe un in determinismo en<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">la ejecución. De esta forma si se ejecuta un programa<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">concurrente varias veces puede producir resultados<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">diferentes partiendo de los mismos datos.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Interacción entre procesos: Los programas concurrentes<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">implican interacción entre los distintos procesos que los<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">componen:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">• Un programa concurrente se suele concebir como un conjunto<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">de procesos que colaboran y compiten entre sí por<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">el acceso a los mismos.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">- Los procesos que se comunican entre sí para<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">intercambiar datos.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">En ambas situaciones se necesita que los procesos<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">sincronicen su ejecución, para evitar conflictos o<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">establecer contacto para el intercambio de datos. La<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">interacción entre procesos se logra mediante variables<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">compartidas o bien mediante el paso de mensajes.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Además la interacción puede ser explícita, si aparece en<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">la descripción del programa, o implícita, si aparece<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">durante la ejecución del programa.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></div>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Arial, sans-serif; font-size: 13pt;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 13pt;">Aplicaciones clásicas:</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Programación de sistemas multicomputadores.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Sistemas operativos.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Control y monitorización de sistemas físicos.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;">• Aplicaciones actuales:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Servicios WEB.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Sistemas multimedia.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Cálculo numérico.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Procesamientos entrada/salida.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13pt;"> Simulación de sistemas dinámicos.<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm; text-align: justify;">
</div>
<div style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px; white-space: pre-wrap;">
<u1:p></u1:p></div>
</div>
Anonymoushttp://www.blogger.com/profile/09718651242233265632noreply@blogger.com7