Está en la página 1de 7

INSTITUTO TECNOLGICO SUPERIOR DE LERDO

Reporte de Prctica


Nmero y Nombre de prctica: #4


Materia: Desarrollo En Java


Alumno: Daniel Reyna Rodrguez

No. De Control: 10231669


Fecha: 25 de agosto de 2014






Cd. Lerdo, Dgo.
Instituto Tecnolgico Superior de Lerdo

| 2


Ttulo: Elaborar un reporte de los programas desarrollados en clase usando las
estructuras if y switch.


Objetivo:
Desarrollar los programas dictados en clase

Equipo:
-Francisco Eduardo Rodrguez Campos
-Jordan Michel Chairez Sifuentes
-Edmundo Orozco Medina
-Daniel Reyna Rodrguez
-Miguel ngel Rosales Campos

Herramientas:
-Pc
-Netbeans
-Word









Instituto Tecnolgico Superior de Lerdo

| 3

Procedimiento
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.util.Scanner;
/**
*
* @author clase
*/
public class JavaApplication1 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

String letra;
int n=5;
int n2=0;
String res=" ";
Scanner lectura = new Scanner(System.in);
System.out.println("Ingresa un caracter");
Instituto Tecnolgico Superior de Lerdo

| 4


letra=lectura.next();

System.out.println(letra);


while(n>0)
{
n--;
while(n2<n)
{
res+=" ";
n2++;
}

switch(n)
{
case 4:
System.out.println(res+" "+letra);
break;
case 3:
System.out.println(res+letra+" "+letra);
break;
case 2:
Instituto Tecnolgico Superior de Lerdo

| 5

System.out.println(res+letra+" "+letra);
break;
case 1:
System.out.println(res+letra+" "+letra);
break;
case 0:
System.out.println(res+letra+" "+letra+" "+letra+" "+letra+" "+letra+" "+letra);
break;
}

res=" ";






Instituto Tecnolgico Superior de Lerdo

| 6

Ejercicio #2

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication2;
import java.util.Scanner;
/**
*
* @author clase
*/
public class JavaApplication2 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

int num;
Scanner lectura = new Scanner(System.in);

System.out.println("Ingresa un numero");

num= lectura.nextInt();
int n=0;
char dato[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

while(n<num)
{
n++;
System.out.println("LETRAS: "+dato[n-1]);
}




}
}







Instituto Tecnolgico Superior de Lerdo

| 7

También podría gustarte