Good Day fellow Stackoverflow guyz, I have a problem with my code, The value of the last line is always zero. I don't know why if my Public Function is right or wrong but I feel it's just in there.
Imports System
Public Class Dog
Private Dogname As String
Private DogAge As Integer
Private ToHumanAge As Integer
Private DogBreed As String
Public Sub AcceptDetails()
Console.Write("Enter Dog's Name: ")
Dogname = Console.ReadLine
Console.Write("Enter Age in calendar years: ")
DogAge = Console.ReadLine
Console.Write("Enter Dog's Breed: ")
DogBreed = Console.ReadLine
End Sub
Public Function GetDogAge()
If DogAge <= 2 Then
GetDogAge = DogAge * 11
Else
GetDogAge = (((DogAge - 2) * 5) + 22)
End If
End
End Function
Public Sub Display()
Console.WriteLine("Dog Name: " & Dogname)
Console.WriteLine("Dog Breed: " & DogBreed)
Console.WriteLine("Dog Age to Human:" & GetDogAge())
Console.Read()
End Sub
End Class
Module Module1
Sub Main()
Dim D As New Dog()
D.AcceptDetails()
D.Display()
Console.Read()
End Sub
End Module