Answer to Question #182325 in Visual Basic for Ian

Question #182325

 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


1
Expert's answer
2021-04-16T15:40:17-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS