Skip to content

Instantly share code, notes, and snippets.

@godie007
Created May 10, 2012 21:38
Show Gist options
  • Select an option

  • Save godie007/2656062 to your computer and use it in GitHub Desktop.

Select an option

Save godie007/2656062 to your computer and use it in GitHub Desktop.
mire santi
package Empresa;
import javax.swing.JOptionPane;
public class Empresa {
public static void main(String[] args) {
int contador1 = 0;
int contador2 = 0;
int contador3 = 0;
for (int i = 0; i < 3; i++) {
String nom = JOptionPane.showInputDialog("nombre");
String sexo = JOptionPane.showInputDialog("Sexo");
int edad = Integer.parseInt(JOptionPane.showInputDialog("edad"));
if (sexo.equals("m")) {
contador2++;
}else if (sexo.equals("f")) {
contador3++;
}
if (nom.charAt(0) == 'a')
contador1++;
}
System.out.println("Nombres por A:" + contador1
+" hombres: "+contador3+" mujeres: "+contador3+"");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment