Академический Документы
Профессиональный Документы
Культура Документы
'DECLARACION DE VARIABLES
Dim valorc, descuento, totalp As Double
Dim nombrec, colorb As String
'cambiamos escribir por messagebox.show
'msgbox
MessageBox.Show("PROGRAMA PARA DETERMINAR DESCUENTO", "TIENDA DE PEPITA")
'ENTRADA DE DATOS
'Para leer cambiamos por inputbox
nombrec = UCase(InputBox("DIGITE EL NOMBRE DEL CLIENTE", "INGRESE DATO"))
valorc = Val(InputBox("DIGITE EL VALOR DE LA COMPRA", "INGRESE DATO"))
colorb = UCase(InputBox("ELIJA COLOR 1. BLANCO 2. AZUL 3. ROJO", "INGRESE
DATO"))
'HACEMOS CALCULOS
'validamos , reemplazamos SI por IF
If colorb = "1" Or colorb = "2" Or colorb = "3" Then
'POR VERDADERO
If colorb = "1" Then
descuento = 0
Else
If colorb = "2" Then
descuento = valorc * 0.25
Else
descuento = valorc * 0.5
End If
End If
'HACEMOS CALCULOS
totalp = valorc – descuento
'IMPRIME RESULTADOS
MessageBox.Show(nombrec & Chr(13) & "VALOR DE LA COMPRA " & valorc &
Chr(13) _
& "DESCUENTO " & descuento & Chr(13) & "VALOR A PAGAR " & totalp)
Else
'POR FALSO
MessageBox.Show("LAS OPCIONES SON 1, 2 O 3", "ERROR EN COLOR",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
End Class
EJERCICIO DE LA BOLITA CON SENTENCIA
'DECLARACION DE VARIABLES
Dim valorc, descuento, totalp As Double
Dim nombrec, colorb As String
'cambiamos escribir por messagebox.show
'msgbox
MessageBox.Show("PROGRAMA PARA DETERMINAR DESCUENTO", "ESTE ES OTRO")
'ENTRADA DE DATOS
'Para leer cambiamos por inputbox
nombrec = UCase(InputBox("DIGITE EL NOMBRE DEL CLIENTE", "INGRESE DATO"))
valorc = Val(InputBox("DIGITE EL VALOR DE LA COMPRA", "INGRESE DATO"))
colorb = UCase(InputBox("ELIJA COLOR 1. BLANCO 2. AZUL 3. ROJO", "INGRESE
DATO"))
'HACEMOS CALCULOS
'VALIDAMOS , REEMPLAZOMOS SI PO IF
If colorb = "1" Or colorb = "2" Or colorb = "3" Then
'POR VERDADERO
End If
End Sub
End Class