Programa que asigna una definitiva de notas - Con clases
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (ComboBox1.SelectedIndex) = 0 Then
Dim cli As New POO
cli.codigo = InputBox("digite codigo")
cli.NOTA_1 = InputBox("digite nota_1")
cli.NOTA_2 = InputBox("digite nota_2")
cli.NOTA_3 = InputBox("digite nota_3")
cli.cali_poo()
cli.mostrar()
Else
Dim cli_m As New BD
cli_m.codigo = InputBox("digite codigo")
cli_m.n_1 = InputBox("digite nota_1")
cli_m.n_2 = InputBox("digite nota_2")
cli_m.cali_BD()
cli_m.mostrar()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("ASIGNATURA POO")
ComboBox1.Items.Add("ASIGNATURA DB")
End Sub
End Class
Se utilizan 3 clases
Public Class ASIGNATURA
Public codigo As Integer
Public def As Integer
Sub mostrar()
MessageBox.Show(CStr(def), "definitiva", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class
Public Class BD
Inherits ASIGNATURA
Public n_1 As Integer
Public n_2 As Integer
Sub cali_BD()
def = ((n_1 * 0.2) + (n_2 * 0.8))
End Sub
End Class
Public Class POO
Inherits ASIGNATURA
Public NOTA_1 As Integer
Public NOTA_2 As Integer
Public NOTA_3 As Integer
Sub cali_poo()
def = ((NOTA_1 + NOTA_2 + NOTA_3) / 3)
End Sub
End Class
Programa hecho en visual studio
lenguaje: .net
Comentarios
Publicar un comentario