Define a VB.NET sub procedure known as Bus() which takes departure time, fare and destination as parameters then displays the Bus fare based on the three parameters else it displays appropriate error mechanism using appropriate mechanism
Module Module1
Sub Main()
Dim departureTime As String
Dim fare As Double
Dim destination As String
Console.Write("Enter the departure time: ")
departureTime = Console.ReadLine()
Console.Write("Enter the fare: ")
fare = Double.Parse(Console.ReadLine())
Console.Write("Enter the destination: ")
destination = Console.ReadLine()
Bus(departureTime, fare, destination)
Console.ReadLine()
End Sub
''' <summary>
''' Bus() which takes departure time, fare and destination as parameters
''' </summary>
''' <param name="departureTime"></param>
''' <param name="fare"></param>
''' <param name="destination"></param>
''' <remarks></remarks>
Sub Bus(ByVal departureTime As String, ByVal fare As Double, ByVal destination As String)
If fare > 0 Then
Console.WriteLine()
Console.WriteLine("The departure time: " + departureTime)
Console.WriteLine("The fare: " + fare.ToString("C"))
Console.WriteLine("The destination: " + destination)
Else
Console.WriteLine()
Console.WriteLine("Error: enter a correct fare>0")
Console.WriteLine()
End If
End Sub
End Module
Comments
Leave a comment