Sie sind auf Seite 1von 6

DEPARTAMENTO DE ENERGÍA Y MECÁNICA

CARRERA DE INGENIERÍA AUTOMOTRIZ

INFORME DE LABORATORIO No. 4

ASIGNATURA: CÓDIGO: NRC: NIVEL: SEMANA CLASE: DURACIÓN:


PROGRAMACION II COMP15083 2099 II III 6 HORAS
DEPARTAMENTO: CARRERA: ÁREA DEL CONOCIMIENTO: TEMA:
ENERGÍA Y MECÁNICA INGENIERÍA PROGRAMACIÓN BUCLE WHILE Y DO
AUTOMOTRIZ WHILE
DOCENTE: ALUMNO: FECHA REALIZACIÓN: EJE DE FORMACIÓN:
ING. LUIS ALBERTO GUERRA PEÑA OBACO RONNY 09-MAYO-2016 PROFESIONAL
CRUZ MsC ANTONIO FECHA DE ENTREGA:
11-MAYO-2016

A. FUNDAMENTACIÓN: BUCLE WHILE, INSTRUCCIÓN REPETITIVA.

El bucle while permite repetir la ejecución de una serie de instrucciones mientras que se cumpla
una condición de continuidad. {Instrucciones a ejecutar de forma repetitiva};

 Primera Forma

while(condición de continuidad)
{Instrucciones a ejecutar de forma repetitiva};

 Segunda Forma

do
{Instrucciones a ejecutar de forma repetitiva}
while(condición de continuidad);

B. DESCRIPCIÓN:
Éste laboratorio está formado por 2 ejercicios:

1. Implemente un algoritmo que le permita ingresar e imprimir los 10 dulces que se sirvió
su mami por el día de la madre, use el bucle “while”.

2. Implemente un algoritmo que le permita ingresar e imprimir los 10 dulces que se sirvió
su mami por el día de la madre, use el bucle “do while”.

C. OBJETIVO:
Conocer y aprender la utilización, sintaxis y restricciones de la instrucción “while y do while” de
manera correcta en lenguaje JAVA.

D. PROYECTO:
Conocer el funcionamiento de la instrucción o bucle “while y do while”.
E. TAREAS A REALIZAR:
Conocer y aprender la utilización, sintaxis y restricciones de la instrucción “while y do while” de
manera correcta en lenguaje JAVA.
Además realizar los ejercicios solicitados en el laboratorio.

F. ANÁLISIS:

ANÁLISIS DE DATOS:

private cont int;

ANÁLISIS DE FUNCIONES:

public IncrementarCont ();

G. DISEÑO:

DISEÑO LÓGICO:

Bucle_While_Y_DoWhile
- cont :
+ IncremetarCont ()

DISEÑO FÍSICO:

Bucle_While_Y_DoWhile
- cont : int
+ IncremetarCont () : int

H. IMPLEMENTACIÓN:

 PRIMER EJERCICIO: Implemente un algoritmo que le permita ingresar e imprimir


los 10 dulces que se sirvió su mami por el día de la madre, use el bucle “ while”.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lab6_while1;

/**
*
* @author RonnyP
*/
public class Lab6_While1 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int cont=1;
while(cont<=10)
{
System.out.println("Dulce: "+cont);
cont++;
}
}
}

 SEGUNDO EJERCICIO: Implemente un algoritmo que le permita implementar la


suma de los primeros 100 números enteros positivos.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lab7_dowhile;

/**
*
* @author RonnyP
*/
public class Lab7_doWhile {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int cont=1;
do{
System.out.println("Dulce"+cont);
cont++;
}while(cont<=10);
}
}

PRUEBA DE CAJA NEGRA:

 Primer Ejercicio
 Segundo Ejercicio

PRUEBA DE CAJA BLANCA:

 Primer Ejercicio
 Segundo Ejercicio

I. Reporte

REQUERIMIENTOS FUNCIONALES ANÁLISIS DISEÑO IMPLEMENTACIÓN PRUEBAS TOTAL


IncrementarCont ();

J. RESULTADOS Y CONCLUSIONES:

 Se ha logrado conocer y realizar algoritmos con el bucle “while” el cual sirvió de mucha
ayuda al momento de sintetizar la implementación además las dos instrucciones cumplen
con la misma función la cual se les pida.
 Además se conoció las diferencias que existen entre los bucles while y dowhile.

K. ACTIVIDADES SEGÚN CRONOGRAMA:


CUARTA ENTREGA: 11 de mayo de 2016
BUCLE WHILE Y DOWHILE

L. REFERENCIAS BIBLIOGRÁFICAS:

Nombre de la obra: Apuntes de Clase.


Nombre de autor (es): Ing. Luis Alberto Guerra
Editorial: ESPE
Año de edición: 2016

[online]: http://www.espe.edu.ec
Tema: Sentencias de Control

Nombre de la obra: Programación en Java


Nombre de autor (es): Foro Web
Editorial: WIKILIBROS
Año de edición: 2016

[online]: https://es.wikibooks.org/wiki/Programaci%C3%B3n_en_Java/S
Tema: entencia_while
Programación en JAVA

Das könnte Ihnen auch gefallen