Created
April 23, 2015 16:55
-
-
Save naranjja/3e04ba20d600635ffa43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Esta versión usa formularios | |
'Textboxes para las notas, que se convierten a double con Val(textbox.Text) | |
Dim notaMin As Single | |
Dim promedio As Single | |
If Val(nota1.Text) < 0 Or Val(nota1.Text) > 20 Then | |
nota1.Text = "" | |
Error1.Caption = "(!)" | |
Else: Error1.Caption = "" | |
End If | |
notaMin = Val(nota1.Text) | |
If Val(nota2.Text) < 0 Or Val(nota2.Text) > 20 Then | |
nota2.Text = "" | |
Error2.Caption = "(!)" | |
Else: Error2.Caption = "" | |
End If | |
If Val(nota2.Text) < notaMin Then notaMin = Val(nota2.Text) | |
If Val(nota3.Text) < 0 Or Val(nota3.Text) > 20 Then | |
nota3.Text = "" | |
Error3.Caption = "(!)" | |
Else: Error3.Caption = "" | |
End If | |
If Val(nota3.Text) < notaMin Then notaMin = Val(nota3.Text) | |
If Val(nota4.Text) < 0 Or Val(nota4.Text) > 20 Then | |
nota4.Text = "" | |
Error4.Caption = "(!)" | |
Else: Error4.Caption = "" | |
End If | |
If Val(nota4.Text) < notaMin Then notaMin = Val(nota4.Text) | |
promedio = (Val(nota1.Text) + Val(nota2.Text) + Val(nota3.Text) + Val(nota4.Text) - notaMin) / 3 | |
Resultado.Caption = "El promedio es " & promedio & "." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment