0% found this document useful (0 votes)
8 views3 pages

Vector Operations and Student Class in VB.NET

The document contains code to define a class called Alumno (Student) with properties for name, age, and three test scores. It also contains a Main procedure that creates an instance of the Alumno class, gets user input for the property values, and calculates the average test score. Any errors are caught and handled.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Vector Operations and Student Class in VB.NET

The document contains code to define a class called Alumno (Student) with properties for name, age, and three test scores. It also contains a Main procedure that creates an instance of the Alumno class, gets user input for the property values, and calculates the average test score. Any errors are caught and handled.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Module Module1

Sub Main()
On Error GoTo ControlError
[Link]("Vector de 10 numeros")
Dim T(9) As Integer
For i = 0 To 9
[Link]("Ingrese el numero de la posicion {0} del vector T: ", i + 1)
T(i) = [Link]()
Next
[Link]()
[Link]("El vector T es de la forma:")
For i = 0 To 9
[Link]("{0} ", T(i))
Next
[Link]()
Dim k1 As Integer
[Link]("Ingrese la posicion: ")
k1 = [Link]()
[Link]()
Dim c As Double
For i = 0 To 9
If i = k1 Then
c = T(i)
End If
Next
Dim K(9) As Double
For i = 0 To 9
K(i) = T(i) / c
Next
[Link]()
[Link]("El vecto K es de la forma")
For i = 0 To 9
[Link]("{0} ", K(i))
Next
[Link]()
Exit Sub
ControlError:
[Link]("{0} - {1}", [Link], [Link])
End Sub
End Module

Module Module1
Sub Main()
Dim loAlumnno As New Alumno
Try
[Link]("Ingrese nombre: ")
[Link] = [Link]()
[Link]("Ingrese edad: ")
[Link] = [Link]()
[Link]("Ingrese nota1: ")
loAlumnno.Nota1 = [Link]()
[Link]("Ingrese nota2: ")
loAlumnno.Nota2 = [Link]()
[Link]("Ingrese nota3: ")
loAlumnno.Nota3 = [Link]()
Catch ex As Exception
End Try
End Sub
End Module
Public Class Alumno
Private miNombre As String
Private miEdad As Integer
Private miNota1 As Integer
Private minota2 As Integer
Private minota3 As Integer
Private miPromedio As Double
Public Property Nombre() As String
Get
Return miNombre
End Get
Set(ByVal Value As String)
miNombre = Value
End Set
End Property
Public Property Edad() As Integer
Get
Return miEdad
End Get
Set(ByVal value As Integer)
miEdad = value
End Set
End Property
Public Property Nota1 As Integer
Get
Return miNota1
End Get
Set(ByVal value As Integer)
miNota1 = value
End Set
End Property
Public Property Nota2 As Integer
Get
Return minota2
End Get
Set(ByVal value As Integer)
minota2 = value
End Set
End Property
Public Property Nota3 As Integer
Get

Return minota3
End Get
Set(ByVal value As Integer)
minota3 = value
End Set
End Property
Public Property Promedio As Integer
Get
Return miPromedio
End Get
Set(ByVal value As Integer)
value = ((miNota1 + minota2 + minota3) / 3)
miPromedio = value
End Set
End Property
End Class

You might also like