-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
56 lines (38 loc) · 1.22 KB
/
app.js
File metadata and controls
56 lines (38 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***************************** CALCULAR TOTAL COMPRA CON Y SIN IVA ***************************************************/
const product = {
count: 3,
price: 12.55,
type: "ropa"
};
if(product.count < 0)
product.count = 0;
let totalSin = product.count * product.price;
console.log("El total de la compra sin IVA es: " + totalSin);
let iva = 0.21;
switch(product.type){
case "alimentacion": iva = 0.1;
break;
case "libro": iva = 0.04;
break;
};
let subidaIva = product.price * iva;
let precioCon = product.price + subidaIva;
console.log("El precio del producto con IVA es: " + precioCon);
/***************************** CALCULAR SUELDO ***************************************************/
const empleado = {
bruto: 14500,
hijos: 2,
pagas: 14
}
let retencion = 0;
if(empleado.bruto >= 12000){
if(empleado.bruto >= 24000){
if(empleado.bruto >= 34000){
retencion= 0.30;
}else retencion= 0.16;
}else retencion= 0.08;
}
if(empleado.hijos > 0) retencion = retencion - 0.02;
let neto = empleado.bruto - (empleado.bruto * retencion);
console.log("El sueldo neto anual es de: " + neto);
console.log("El sueldo neto mensual es de: " + (neto/empleado.pagas));