Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Añade tarea clase 6 #52

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
34 changes: 34 additions & 0 deletions tareas/clase-5/datos-user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>


</head>
<body>

<header>
<h1>Bienvenido!</h1>

</header>

<form id="datos-usuario" onsubmit="return false;">
<input type="text" placeholder="Ingresá tu primer nombre" id="primer-nombre-usuario"/>
<input type="text" placeholder="Ingresá tu segundo nombre" id="segundo-nombre-usuario"/>
<input type="text" placeholder="Ingresá tu apellido" id="apellido-usuario"/>
<input type="number" placeholder="Ingresá tu edad" id="edad-usuario" />
<button type="button" id="Ingresar">Ingresar</button>
<button type="reset" id="reset" >Limpiar </button>
</form>


<script type="text/javascript" src='datos-user.js'></script>


</body>


</html>
33 changes: 33 additions & 0 deletions tareas/clase-5/datos-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const botonIngresar = document.querySelector("#Ingresar")

botonIngresar.onclick = function(){

const nombreUsuario = document.querySelector("#primer-nombre-usuario").value
const segundoNombreUsuario = document.querySelector("#segundo-nombre-usuario").value
const apellidoUsuario = document.querySelector("#apellido-usuario").value
const edadUsuario = document.querySelector("#edad-usuario").value


const nodoPagina = document.querySelector("form")
const nuevoParrafo = document.createElement("p")
const nuevoTexto = document.createTextNode(`${nombreUsuario} ${segundoNombreUsuario} ${apellidoUsuario} , ${edadUsuario}`)
nuevoParrafo.appendChild(nuevoTexto)
nodoPagina.appendChild(nuevoParrafo)
document.querySelector("h1").innerText = `Bienvenido, ${nombreUsuario}!`


return false;

}

const botonLimpiar = document.querySelector("#reset")
botonLimpiar.onclick = function(){
limpiarPagina()
}

function limpiarPagina(){
let $p = document.querySelector("p")
let form = document.getElementById("datos-usuario")
document.querySelector("h1").innerText = "Bienvenido!"
form.removeChild($p)
}
42 changes: 42 additions & 0 deletions tareas/clase-5/lista.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Listas</title>
</head>

<body>
<ol id="lista-numeros">
<li>1</li>
<li>42</li>
<li>96</li>
<li>0</li>
<li>-32</li>
<li>53</li>
<li>11</li>
<li>42</li>



</ol>

<em id="promedio">El promedio es...</em>
<br>
<em id= "mas-grande">El numero mas grande es...</em>
<br>
<em id = "mas-pequeño">El numero mas pequeño es...</em>
<br>
<em id = "mas-frecuente"></em>



<script src="listas.js"></script>

</body>
</html>


63 changes: 63 additions & 0 deletions tareas/clase-5/listas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const listaNumeros = document.querySelectorAll("li")
const array = []
for (i = 0; i < listaNumeros.length; i++){
array.push(Number(listaNumeros[i].innerText));

}

function sacarPromedio(array){
let sumaNumeros = 0
for(i = 0; i < array.length; i++){
sumaNumeros += array[i]
}
return sumaNumeros / array.length
}

const promedio = sacarPromedio(array)
document.querySelector("#promedio").textContent = `El promedio es ${promedio}`

function sacarMenor(array){
let numeroMenor = array[0]
for(i = 0; i < array.length; i++){
if (numeroMenor > array[i]){
numeroMenor = array[i]
}
}
return numeroMenor

}

const numeroMenor = sacarMenor(array)
document.querySelector("#mas-pequeño").innerText = "El numero mas pequeño es " + numeroMenor


function sacarMayor(array){
let numeroMayor = array[0]
for(i = 0; i < array.length; i++){
if (numeroMayor < array[i]){
numeroMayor = array[i]
}
}
return numeroMayor

}

const numeroMayor = sacarMayor(array)
document.querySelector("#mas-grande").innerText = "El numero mas grande es " + numeroMayor

function masFrecuente(array){
const tempArray = array.sort();
let duplicados = []
for (i = 0; i < array.length; i++){
if (tempArray[i] === tempArray[i+1]){
duplicados.push(tempArray[i]);
}
} return Number(duplicados)
}


const $masFrecuente = masFrecuente(array)
document.querySelector("#mas-frecuente").innerText = "El numero mas frecuente es " + $masFrecuente



3 changes: 3 additions & 0 deletions tareas/clase-5/tiempo-clases.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.oculto {
display: none;
}
66 changes: 66 additions & 0 deletions tareas/clase-5/tiempo-clases.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Tiempo clases</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel="stylesheet" href="tiempo-clases.css"/>


</head>

<body>
<form onsubmit="return false;">
<label>Clase 1
<input type="number" placeholder="Horas" class="horas" id="horas-clase1"/>
<input type="number" placeholder="Minutos" class="minutos" id="minutos-clase1" />
<input type="number" placeholder="Segundos" class="segundos" id="segundos-clase1" />
</label>
<br>
<label>Clase 2
<input type="number" placeholder="Horas" class="horas" id="horas-clase2"/>
<input type="number" placeholder="Minutos" class="minutos" id="minutos-clase2" />
<input type="number" placeholder="Segundos" class="segundos" id="segundos-clase2" />
</label>
<br>
<label> Clase 3
<input type="number" placeholder="Horas" class="horas" id="horas-clase3"/>
<input type="number" placeholder="Minutos" class="minutos" id="minutos-clase3" />
<input type="number" placeholder="Segundos" class="segundos" id="segundos-clase3" />
</label>
<br>
<label> Clase 4
<input type="number" placeholder="Horas" class="horas" id="horas-clase4"/>
<input type="number" placeholder="Minutos" class="minutos" id="minutos-clase4" />
<input type="number" placeholder="Segundos" class="segundos" id="segundos-clase4" />
</label>
<br>
<label> Clase 5
<input type="number" placeholder="Horas" class="horas" id="horas-clase5"/>
<input type="number" placeholder="Minutos" class="minutos" id="minutos-clase5" />
<input type="number" placeholder="Segundos" class="segundos" id="segundos-clase5" />
</label>
<br>




<button type="button" id="calcular">Calcular tiempo total</button>

<div class ="oculto" id ="tiempo-total"> Tiempo total
<br>
<strong id="horas-totales"></strong>
<br>
<strong id = "minutos-totales"> </strong>
<br>
<strong id = "segundos-totales"></strong>
<br>
</div>

</form>

<script src="tiempo-clases.js"></script>
</body>

</html>
58 changes: 58 additions & 0 deletions tareas/clase-5/tiempo-clases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

function calcularSegundos(){
const totalSegundos = document.querySelectorAll(".segundos")
return acumularElementos(totalSegundos)
}

function calcularMinutos(){
const totalMinutos = document.querySelectorAll(".minutos")
return acumularElementos(totalMinutos)
}

function calcularHoras(){
const totalHoras = document.querySelectorAll(".horas")
return acumularElementos(totalHoras)
}


function acumularElementos(elementos){
let sumaElementos = 0
for (i = 0; i < elementos.length; i++){
sumaElementos += Number(elementos[i].value)
}
return sumaElementos
}

function mostrarTiempoTotal(){
document.querySelector("div").className = " "
}

const botonCalcular = document.querySelector("#calcular")

botonCalcular.onclick = function(){



mostrarTiempoTotal()

const sumaSegundos = calcularSegundos()
const sumaMinutos = calcularMinutos()
const sumaHoras = calcularHoras()

const minutosEnterosDeSegundos = Math.floor(sumaSegundos/ 60)
const segundosDefinitivos = sumaSegundos % 60

const totalMinutos = sumaMinutos + minutosEnterosDeSegundos
const horasEnterasDeMinutos = Math.floor(totalMinutos / 60)
const minutosDefinitivos = totalMinutos % 60

const horasDefinitivas = horasEnterasDeMinutos + sumaHoras

document.querySelector("#horas-totales").innerText = "Las horas totales son " + horasDefinitivas
document.querySelector("#minutos-totales").innerText = "Los minutos totales son " + minutosDefinitivos
document.querySelector("#segundos-totales").innerText = "Los segundos totales son " + segundosDefinitivos


}


46 changes: 46 additions & 0 deletions tareas/clase-6/calculos-mio.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,49 @@ function obtenerPromedio(numeros) {

return (acumulador / numeros.length).toFixed(2);
}

function obtenerMayorSalario(array){
let mayorSalario = array[0]
for (i = 0; i < array.length; i ++){
if (array[i] > mayorSalario){
mayorSalario = array[i]
}
} return mayorSalario;
}

function obtenerMenorSalario(array){
let menorSalario = array[0]
for (i = 0; i < array.length; i ++){
if (array[i] < menorSalario){
menorSalario = array[i]
}
} return menorSalario;
}

function obtenerPromedioSalarios(array) {
let suma = 0;
for (let i = 0; i < array.length; i++) {
suma += array[i];
}

return (suma / array.length).toFixed(2);
}


function obtenerSalariosMensuales(array){
let array2 = []

for (i = 0; i < array.length; i++){
array2.push(Number(array[i] / 12))
}
return array2
}

function obtenerPromedioSalariosMensuales(array2){
let suma2 = 0;
for (let i = 0; i < array2.length; i++) {
suma2 += array2[i];
}

return (suma2 / array2.length).toFixed(2);
}
Loading