-
-
Save sanrodari/2656286 to your computer and use it in GitHub Desktop.
This file contains 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
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")); | |
boolean valido = true; | |
if (sueldo1 <= 300 && sueldo1 >= 100) { | |
contador++; | |
} else if (sueldo1 > 300 && sueldo1 <= 500) { | |
contador2++; | |
} | |
else{ | |
JOptionPane.showMessage(null, "Salario no valido"); | |
valido = false; | |
} | |
if(valido){ | |
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