Skip to content

Instantly share code, notes, and snippets.

@godie007
Created May 10, 2012 22:21
Show Gist options
  • Save godie007/2656276 to your computer and use it in GitHub Desktop.
Save godie007/2656276 to your computer and use it in GitHub Desktop.
public class Ejercicio1 {
public static void main(String[] args) {
int contador = 0;
int contador2 = 0;
int importe = 0;
int users = Integer.parseInt(JOptionPane.showInputDialog("Numero de Usuarios"));
for (int i = 0; i < users; i++) {
int sueldo1 = Integer.parseInt(JOptionPane.showInputDialog("sueldo"));
if (sueldo1 <= 300 && sueldo1 >= 100) {
contador++;
} else if (sueldo1 > 300 && sueldo1 <= 500) {
contador2++;
}importe += sueldo1;
}
System.out.println("A: " + contador + " B: " + contador2 +" Importe: "+importe);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment