lunes, 24 de mayo de 2010

CICLO FOR

import javax.swing.JOptionPane;
public class seriefor
{
public static void main (String args [ ])
{

// DECLARACION DE VARIABLES
int n, i;
String entrada, name;

// ENTRADA DE DATOS
name = JOptionPane.showInputDialog (" Cómo te llamas ?.....");


// CICLO FOR
String cad=" ";
for (i = 1; i <= 10; i++) {
cad= cad + "\n" +i;

}

// SALIDA DE DATOS
JOptionPane.showMessageDialog
(null,"LA SERIE DE NUMEROS ES \n" +cad);

System.exit(0);
}
}

lunes, 17 de mayo de 2010

PROGRAMA IF - ELSE

import javax.swing.JOptionPane;
public class mayoredad2
{
public static void main (String args [ ])
{
// DECLARACION DE VARIABLES
int edad;
String entrada, name;
// ENTRADA DE DATOS
name = JOptionPane.showInputDialog (" ¿ Cómo te llamas ?.....");
entrada = JOptionPane.showInputDialog ("¿ Cuál es tu edad ? ");
edad = Integer.parseInt(entrada);
// CONDICIÓN
if (edad >= 18)
// SALIDA DE DATOS
JOptionPane.showMessageDialog (null," ERES MAYOR DE EDAD " +name);
else
JOptionPane.showMessageDialog (null," ERES MENOR DE EDAD " +name);
System.exit(0);
}
}

jueves, 13 de mayo de 2010

PRINCIPIOS DE PROGRAMACION 2010

PROGRAMA ARTIMETICA


import javax.swing.JOptionPane;
public class aritmetica
{
public static void main (String args [ ])
{
// DECLARACION DE VARIABLES
float num1, num2, suma, resta, multi, division;
String entrada, name;
// ENTRADA DE DATOS
name = JOptionPane.showInputDialog (" Cómo te llamas ?.....");
entrada = JOptionPane.showInputDialog ("Teclea el primer valor ");
num1 = Float.parseFloat(entrada);
entrada = JOptionPane.showInputDialog ("Teclea el segundo valor ");
num2 = Float.parseFloat(entrada);
// OPERACIONES ARITMETICAS
suma = num1 + num2;
resta = num1- num2;
multi = num1 * num2;
division = num1 / num2;
// SALIDA DE DATOS
JOptionPane.showMessageDialog
(null,"LOS RESULTADOS DE LAS OPERACIONES ARITMETICAS SON: \n \n La suma de " +num1 + " + " +num2 +" = " +suma +"\n La resta de " +num1 + " - " +num2 +" = " +resta +"\n La multiplicacion de " +num1 +" * " +num2 +" = " +multi +"\n La división de " +num1 +" / " +num2 +" = " +division +"\n \n Realizadas por " +name);
System.exit(0);
}
}

P.D. COPIA Y PEGA EN JCREATOR Y/O BLOC DE NOTAS, COMPILA Y EJECUTALO, VERAS LO QUE REALIZA ESTE PROGRAMA.

SALUDOS CORDIALES.

LRV

domingo, 9 de mayo de 2010

SUBMODULO: OPERAR EQUIPO DE COMPUTO