Imports System.IO
Module Module1
Sub Main()
Dim p As New Professor()
p.Name = "JOe"
p.OfficeNumber = "123A"
p.AssignAge(35)
p.AssignHomePhone("555-1111")
p.ShowProfessor()
End Sub
End Module
Class Professor
Public Name As String
Private Age As Integer
Public OfficeNumber As String
Private HomePhone As String
Public Sub ShowProfessor()
Console.WriteLine("Name: " & Name)
Console.WriteLine("Age: " & Age)
Console.WriteLine("Office Number: " & OfficeNumber)
Console.WriteLine("Home Phone: " & HomePhone)
End Sub
Public Sub AssignAge(ByVal EmpAge As Integer)
If (EmpAge > 18) And (EmpAge < 100) Then
Age = EmpAge
End If
End Sub
Public Sub AssignHomePhone(ByVal Phone As String)
HomePhone = Phone
End Sub
End Class
|