Hello everyone.

I have an issue with calling a couple functions to return the desired value. What I am trying to do is get the type of material and its thickness and output time in seconds that sound will take to go through the material. Here is the code I have so far:


Option Explicit


Public Function GetSpeedOfSound(strMaterial As String) As Double
Select Case LCase(strMaterial)
Case "air"
GetSpeedOfSound = 1126.1 'this case returns 1126.1 feet per second
Case "water"
GetSpeedOfSound = 4603.2 'this case returns 4603.2 feet per second
Case "steel"
GetSpeedOfSound = 20013.3 'this case returns 20013.3 feet per second
Case "earth"
GetSpeedOfSound = 22967.4 'this case returns 22967.4 feet per second
End Select
End Function

Public Function GetInverseSpeed(strMaterial As String) As Double
GetInverseSpeed = 1 / GetSpeedOfSound(strMaterial)
End Function

'purpose: get the type of material and its thickness and output time in seconds that sound will take to go through the material
'param strMaterial: a string specifying the kind of material ("air", "water", "steel", "earth")_
'param dblThick: a double specifying the amount of thickness of the material
'returns: the number of seconds it takes for sound to go through thickness of the material
Public Function GetSpeedThroughMaterial(strMaterial As String, dblThick As Double) As Double
GetSpeedThroughMaterial = GetInverseSpeed(strMaterial) + GetSpeedOfSound(strMaterial)
End Function


The first two functions are working as they should, but I am not sure how to write the GetSpeedThroughMaterial function to return the desired calculation. All I know is that I should be able to accomplish this task with one line of code. I know I'm over thinking this, but for some reason it's just not clicking for me. Any help would greatly be appreciated. Thank you!