I believe I have the correct calculation for obtaining a persons age if they put in their birth date and maybe even correct for the GPA calculation based off of three course grades entered as Integers and returned as a GPA double, but do not understand how to output this all in Listbox from one button click using two classes and inheritance. SMH
Public Class Form1 Dim dateofBirth As Date Public Class Person Public first As String Public last As String Public dateofBirth As Date Function Age() As Integer Dim today As Date = Now() Dim years As Integer = today.Year - dateofBirth.Year Return years End Function End Class Public Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ListBox1.Items.Add("Name: " & first.Text & " " & last.Text) ListBox1.Items.Add("") ListBox1.Items.Add("Age: " & (birth.Age)) End Sub Public Class Student Inherits Person Dim eGrade As Double Dim mGrade As Double Dim sGrade As Double Public Function EnglishGPA() As Double Dim GPA(0) As Double If CInt(eGrade) >= 90 Then GPA(0) = 4 ElseIf CInt(eGrade) >= 80 Then GPA(0) = 3 ElseIf CInt(eGrade) >= 70 Then GPA(0) = 2 ElseIf CInt(eGrade) >= 60 Then GPA(0) = 1 ElseIf CInt(eGrade) < 60 Then GPA(0) = 0 End If Return GPA(0) End Function Public Function MathGPA() As Double Dim GPA(1) As Double If CInt(mGrade) >= 90 Then GPA(1) = 4 ElseIf CInt(mGrade) >= 80 Then GPA(1) = 3 ElseIf CInt(mGrade) >= 70 Then GPA(1) = 2 ElseIf CInt(mGrade) >= 60 Then GPA(1) = 1 ElseIf CInt(mGrade) < 60 Then GPA(1) = 0 End If Return GPA(1) End Function Public Function ScienceGPA() As Double Dim GPA(2) As Double If CInt(sGrade) >= 90 Then GPA(2) = 4 ElseIf CInt(sGrade) >= 80 Then GPA(2) = 3 ElseIf CInt(sGrade) >= 70 Then GPA(2) = 2 ElseIf CInt(sGrade) >= 60 Then GPA(2) = 1 ElseIf CInt(sGrade) < 60 Then GPA(2) = 0 End If Return GPA(2) End Function Public Function TermGPA() As Double Dim TGPA As Double TGPA = (EnglishGPA() + MathGPA() + ScienceGPA() / 3) Return TGPA End Function End Class End Class