Last active
November 5, 2017 04:41
-
-
Save DiegoTc/bb42f7ff7a60d7759d73b84d17b838d9 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
import java.util.Scanner; | |
public class Ejercicio2{ | |
public static void main(String[] args) { | |
int contador =0; | |
int sueldo =0; | |
int extra = 0; | |
int horas = 0; | |
Scanner Scanner = new Scanner(System.in); | |
while(contador <3){ | |
System.out.print("Ingrese el total de horas trabajadas: "); | |
horas = Scanner.nextInt(); | |
System.out.print("Ingrese la tarifa por hora: "); | |
sueldo = Scanner.nextInt(); | |
extra = horas - 40; | |
if(extra <=0){ | |
System.out.println("El empleado trabajo: "+ horas + " y no trabajo horas extra"); | |
System.out.println("Su sueldo es: "+ sueldo*horas); | |
} | |
else{ | |
System.out.println("El empleado trabajo: "+ horas + " y " + extra + " horas extra"); | |
extra = ((sueldo/2)+ sueldo) * extra; | |
sueldo = sueldo * horas; | |
System.out.println("Su sueldo sin horas extra es de: "+ sueldo+ " y de pagos extra es de: "+extra+" y el total es: "+ (sueldo+extra)); | |
} | |
contador++; | |
} | |
} | |
} |
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
import java.util.Scanner; | |
public class Ejercicio3{ | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int numero=0; | |
int contador =0; | |
int mayor = Integer.MIN_VALUE; | |
while(contador < 10){ | |
System.out.print("Ingrese un numero entero: "); | |
numero = sc.nextInt(); | |
if(numero > mayor){ | |
mayor = numero; | |
} | |
contador++; | |
} | |
System.out.println("El numero mayor es: "+ mayor); | |
} | |
} |
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
public class Ejercicio4{ | |
public static void main(String[] args) { | |
int i=0; | |
while(i<=5){ | |
if(i ==0){ | |
System.out.println("N\t 10xN\t 100xN\t 1000xN"); | |
} | |
else{ | |
System.out.println(i+"\t"+i*10+"\t"+ i*100+"\t"+i*1000); | |
} | |
i++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment