Last active
May 16, 2024 03:54
-
-
Save duranangie/fa04084a6dd312c5139817d0f4447e68 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
package helloword; | |
public class HelloWord { | |
public static void main(String[] args) { | |
String categoria= ""; | |
int empleado=3; | |
double salarioBase=0.0; | |
double porcentajeBono=0; | |
switch (empleado) { | |
case 1: | |
salarioBase=18.890; | |
porcentajeBono=0.10; | |
salarioBase += salarioBase*porcentajeBono; | |
categoria="Repositor"; | |
break; | |
case 2: | |
salarioBase=25.630; | |
categoria="Cajero"; | |
break; | |
case 3: | |
salarioBase=35.560; | |
porcentajeBono=0.11; | |
salarioBase-= salarioBase*porcentajeBono; | |
categoria="supervisor"; | |
break; | |
default: System.out.println( "Verifique los datos ingresados"); | |
break; | |
} | |
System.out.println("el pago del " +categoria+ " es: "+salarioBase); | |
} | |
} | |
// CON IF | |
package helloword; | |
import java.util.Scanner; | |
public class HelloWord { | |
public static void main(String[] args) { | |
int empleado=0; | |
double salarioBase=0.0; | |
System.out.println("ingrese la categoria de empleado"); | |
Scanner teclado = new Scanner(System.in); | |
empleado=teclado.nextInt(); | |
if (empleado==1){ | |
salarioBase=18.890+(18.890*0.10); | |
System.out.println("el sueldo base de repositor es: "+salarioBase); | |
}else if(empleado==2){ | |
salarioBase=25.630; | |
System.out.println("el sueldo base de cajero es: "+salarioBase); | |
}else if(empleado==3){ | |
salarioBase=35.560-(35.560*0.11); | |
System.out.println("el sueldo base de supervisor es: "+salarioBase); | |
}else{ | |
System.out.println("Erro en la opcion ingresada"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment