Está en la página 1de 2

UNIVERSIDAD NACIONAL DE INGENIERÍA

Facultad de Ingeniería Química y Textil


DEPARTAMENTO ACADÉMICO DE CIENCAS BÁSICAS
Programación Digital – Período 2015-1
FECHA: 14/05/2015

EXAMEN PARCIAL
Tiempo: máximo 100 minutos

Se desea calcular los pagos semanales de N trabajadores. Para cada trabajador, las primeras 40 horas se
pagan con tarifa normal (TN) y el resto se pagan con tarifa de hora extra (TE), sin embargo, hay un
mínimo de horas válidas (MHV), tal que si trabaja menos que MHV, no se le paga nada.
En la hoja mostrada, las celdas de blanco son datos, mientras que las celdas sombreadas son calculadas.

1) Usando fórmulas de Excel, para los datos, que pueden variar, determine (con N=49):
a. Las fórmulas de las celdas C2, D2 y E2, tal que se copien hacia abajo y den los resultados.
b. Las fórmulas de las celdas H6, H7, H8, H9 y H10 asumiendo que ya se hizo 1a).
(3+5= 8 puntos)
2) Usando el lenguaje VBA:
a. Diseñe un programa que calcule y escriba HN, HE y P para el trabajador número 1, cuyas
horas trabajadas HT se encuentran en B2.
b. Diseñe otro programa que lea: cada HT de los N trabajadores, TN, TE y MHV, para
determinar y escribir las variables resultados en todas las celdas sombreadas.
(4+8= 12 puntos)

Sugerencia 2b): Primero usar un For para calcular los pagos, y luego otro(s) para calcular las variables
de la columna H.

Los Profesores.
1)
C2=SI(B2<$H$4,0,SI(B2>=40,40,B2)) HN = 0
D2=SI(B2>40,B2-40,0) HE = 0
Else
E2=C2*$H$2+D2*$H$3
If HT <= 40 Then
H6=SUMA(E:E) HN = HT
H7=MAX(E:E) HE = 0
H8=SUMA(D:D) Else
H9=CONTAR.SI(D:D,">0") HN = 40
H10=CONTAR.SI(E:E,0) HE = HT - 40
End If
2) End If
Sub pregunta2a() P = HN * TN + HE * TE
HT = Range("b2") Cells(i + 1, 3) = HN
TN = Range("h2") Cells(i + 1, 4) = HE
TE = Range("h3") Cells(i + 1, 5) = P
MHV = Range("h4") Next
If (HT < MHV) Then PT = 0
HN = 0 PM = 0
HE = 0 PHE = 0
Else NTHE = 0
If HT <= 40 Then NTSP = 0
HN = HT For i = 1 To N
HE = 0 PT = PT + Cells(i + 1, 5)
Else PHE = PHE + Cells(i + 1, 4)
HN = 40 If (Cells(i + 1, 5) > PM) Then
HE = HT - 40 PM = Cells(i + 1, 5)
End If End If
End If If (Cells(i + 1, 5) = 0) Then
P = HN * TN + HE * TE NTSP = NTSP + 1
Range("c2") = HN End If
Range("d2") = HE If (Cells(i + 1, 4) > 0) Then
Range("e2") = P NTHE = NTHE + 1
End Sub End If
Next
Sub pregunta2b() Range("h6") = PT
N = Range("h1") Range("h7") = PM
TN = Range("h2") Range("h8") = PHE
TE = Range("h3") Range("h9") = NTHE
MHV = Range("h4") Range("h10") = NTSP
For i = 1 To N End Sub
HT = Cells(i + 1, 2)
If (HT < MHV) Then

También podría gustarte