Un programa para calcular el salario neto de un trabajador
marciandrea15Práctica o problema10 de Noviembre de 2015
3.827 Palabras (16 Páginas)186 Visitas
SOLUCIÓN
- Hacer un programa para calcular el salario neto de un trabajador. Se debe ingresar el número de horas de trabajo y el pago por hora. Se consideran horas normales a todas las horas trabajadas hasta un total de 140 al mes. Las horas adicionales a 140 se consideran como extras y una hora extra se paga el 50% más que una hora normal. Los impuestos están en función del monto obtenido por el trabajador. Si el monto obtenido es menor o igual a S/. 2000 no paga impuestos, pero si es mayor paga el 15%. ¿Cuál es el sueldo neto del trabajador y cuál es el monto en impuestos que debe pagar?
[pic 1]
Public Class Form1
Private Sub btnCalcular_Click(sender As Object, e As EventArgs) Handles btnCalcular.Click
Dim ht, th, salario, ph As Integer
ht = Convert.ToInt32(txtHT.Text)
ph = Convert.ToInt32(txtPH.Text)
If rb29.Checked Then
th = ht * 29
If th > 140 Then
salario = (ht * 0.5) + ((ht * ph) * 29)
ElseIf th < 140 Then
salario = (ht * ph) * 29
End If
End If
If rb30.Checked Then
th = ht * 30
If th > 140 Then
salario = (ht * 0.5) + ((ht * ph) * 30)
ElseIf th < 140 Then
salario = (ht * ph) * 30
End If
End If
If rb31.Checked Then
th = ht * 31
If th > 140 Then
salario = (ht * 0.5) + ((ht * ph) * 31)
ElseIf th < 140 Then
salario = (ht * ph) * 31
End If
End If
If salario <= 2000 Then
txtImp.Text = "No paga impuestos"
ElseIf salario > 2000 Then
txtImp.Text = salario * 0.15
End If
txtTH.Text = th
txtSN.Text = salario
txtHT.Text = ht
txtPH.Text = ph
End Sub
Private Sub btnLimpiar_Click(sender As Object, e As EventArgs) Handles btnLimpiar.Click
txtHT.Clear()
rb29.Checked = False
rb30.Checked = False
rb31.Checked = False
txtTH.Clear()
txtPH.Clear()
txtSN.Clear()
txtImp.Clear()
txtHT.Focus()
End Sub
Private Sub btnSalir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
Close()
End Sub
End Class
- Una tienda vende-tres tipos de productos cuyos códigos son 1, 2 y 3 a los precios unitarios dados en la siguiente tabla:
CODIGO | PRECIO UNITARIO |
1 | 20 |
2 | 35 |
3 | 50 |
Como oferta la tienda ofrece un porcentaje de descuento sobre el importe de la compra de acuerdo a la siguiente tabla:
IMPORTE DE COMPRA | DESCUENTO |
>= 1000 | 20 % |
>=800 pero <1000 | 16 % |
>=300 pero < 800 | 12 % |
< 300 | 8 % |
[pic 2]
Public Class Form1
Private Sub btnCalcular_Click(sender As Object, e As EventArgs) Handles btnCalcular.Click
Dim uni As Double, ic, ip As Integer
uni = Convert.ToDouble(txtUnidades.Text)
Select Case cboCodigo.SelectedIndex
Case 1
ic = uni * 20
Case 2
ic = uni * 35
Case 3
ic = uni * 50
End Select
If ic >= 1000 Then
ip = ic + (ic * 0.2)
ElseIf ic >= 800 And ic < 1000 Then
ip = ic + (ic * 0.16)
ElseIf ic >= 300 And ic < 800 Then
ip = ic + (ic * 0.12)
ElseIf ic < 300 Then
ip = ic + (ic * 0.08)
End If
txtIC.Text = ic
txtIP.Text = ip
End Sub
Private Sub btnLimpiar_Click(sender As Object, e As EventArgs) Handles btnLimpiar.Click
txtUnidades.Clear()
cboCodigo.Text = ""
txtIC.Clear()
txtIP.Clear()
txtUnidades.Focus()
End Sub
Private Sub btnSalir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
Close()
End Sub
End Class
- Realice un programa que ingrese el precio del producto y luego se escoja el tipo de producto si es nacional o importado. Si es nacional se le incrementa el 5% del precio, si es importado se incrementa el 12 % del Precio. Se debe reportar el nuevo precio del producto.[pic 3]
Public Class Form1
Private Sub btnCalcular_Click(sender As Object, e As EventArgs) Handles btnCalcular.Click
...