I am new to programming. I am trying to figure out why when a user chooses steel and enters 1 for the distance, the result is strange.
Module Module1
Sub Main()
Dim distance As Integer
Dim userInput As String
Dim airTime, waterTime, steelTime As Double
Dim air, water, steel As Integer
Console.WriteLine("How far will it take to travel through air, water or steel? Choose one and find out")
Console.WriteLine("Please make your selection now: ")
userInput = Console.ReadLine()
Console.WriteLine("Please enter a distance in feet:")
distance = Console.ReadLine()
Select Case userInput
Case "air"
air = 10000 / 9.09
airTime = distance / air
Console.WriteLine("It will take {0:G} seconds to travel {1:G} feet through the air", airTime, distance)
Case "water"
water = 10000 / 2.04
waterTime = distance / water
Console.WriteLine("It will take {0:G} seconds to travel {1:G} feet through the water", waterTime, distance)
Case "steel"
steel = 10000 / 0.61
steelTime = distance / steel
Console.WriteLine("It will take {0:G} seconds to travel {1:G} feet through the steel", steelTime, distance)
End Select
Console.ReadKey()
End Sub
End Module
When a user enters 1 for the distance traveled for steel, the result is 6.10016470444702E-05