Created
May 10, 2012 22:06
-
-
Save godie007/2656189 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Empresa; | |
| import javax.swing.JOptionPane; | |
| public class Empresa { | |
| public static void main(String[] args) { | |
| { | |
| String nombre1, sexo1; | |
| int i, contador1, contador, contador2; | |
| char sexo, nomb; | |
| contador = 0;// contador para mujeres | |
| contador1 = 0;// contador para hombres | |
| contador2 = 0;// contador para nombres | |
| for (i = 0; i <= 5; i++) { | |
| nombre1 = JOptionPane.showInputDialog(null, | |
| "Ingrese su nombre: "); | |
| nomb = nombre1.charAt(0); | |
| nomb = Character.toUpperCase(nomb); | |
| int edad1 = Integer.parseInt(JOptionPane.showInputDialog("")); | |
| sexo1 = JOptionPane.showInputDialog(null, | |
| "Ingrese el sexo M(Mujer) H(Hombre): "); | |
| sexo = sexo1.charAt(0); | |
| sexo = Character.toUpperCase(sexo); | |
| if ((sexo == 'M') || (sexo == 'H')) { | |
| if (sexo == 'M') { | |
| contador = contador + 1; | |
| } else { | |
| contador1 = contador1 + 1; | |
| } | |
| } else { | |
| JOptionPane | |
| .showMessageDialog(null, | |
| "Lo que ingreso de sexo es incorrecto solo puede ser M o H"); | |
| } | |
| if (nomb == 'A') { | |
| contador2 = contador2 + 1; | |
| } | |
| } | |
| JOptionPane | |
| .showMessageDialog( | |
| null, | |
| "Este es el numero de mujeres que se presentaron:" | |
| + contador | |
| + " \n Este es el numero de hombres que se presentaron:" | |
| + contador1 | |
| + " \n Este es el numero de persona que su nombre comienza con la letra A: " | |
| + contador2); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment