Ejercicio N.- 1 Cuatro notas entre 0 y 10 representan las

Anuncio
EJERCICIOS EN VISUAL BASIC
NOMBRE: JENIFFER ARIAS
CURSO: 6º “G”
Ejercicio N.- 1
Cuatro notas entre 0 y 10 representan las calificaciones de un estudiante de un curso
de curso de programación. Elaborar una aplicación para obtener el promedio de esas
calificaciones y visualizar su puntuación de acuerdo al siguiente cuadro.
PROMEDIO
9-10
7-9
5-7
3-5
0-3
CALIFICACION
A
B
C
D
E
REALIZACIÓN
Public Class Form1
Private Sub Button1_Click (ByVal sender As System. Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a, b, c, d, g As Integer
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
d = TextBox4.Text
g = ((a + b + c + d) / 4)
TextBox4.Text = g
Select Case g
Case Is > 9 And g <= 10
TextBox5.Text = "A"
Case Is > 7 And g <= 9
TextBox5.Text = "B"
Case Is > 5 And g <= 7
TextBox5.Text = "C"
Case Is > 3 And g <= 5
TextBox5.Text = "D"
Case Is > 0 And g <= 3
TextBox5.Text = "E"
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Ejercicio N.- 2
Un empleado percibe $ 5.00 por hora por las 40 primeras horas trabajadas y $7.00 por
cada hora siguiente a las 40. Calcular, imprimir y automatizar el ingreso neto del
trabajador.
REALIZACIÓN
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim c, s, total As Integer
c = TextBox1.Text
s = TextBox2.Text
If c <= 40 Then
total = c * 5
End If
total = ((c * 5) + (s * 7))
TextBox3.Text = total
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Ejercicio N.- 4
Verifique si un número N es par o impar, Utilizando el operador MOD
REALIZACIÓN
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim x As Integer
x = TextBox1.Text
If (x Mod 2 = 0) Then
TextBox2.Text = " PAR "
Else
TextBox2.Text = " IMPAR"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Descargar