What do you mean by structured error handling? Create VB .Net console application to accept 10 numbers from user and find its average. Also handle IndexOutOfRangeException.

Module Module1
    Sub Main()
        Dim counter, sum As Integer
        Dim average As Double
        Dim numberArray(10) As Integer
        Console.writeLine("Enter the Numbers : ")
        sum = 0
        For counter = 0 To 9
            Console.write("Number " & (counter + 1) & " : ")
            numberArray(counter) = Console.ReadLine()
            sum += numberArray(counter)
        Next counter
        average = sum / 10
        Console.writeLine("Average of 10 Numbers is : " & average)
        Console.writeLine("Handle IndexOutOfRangeException")
        Try
            sum = numberArray(15)
            Console.WriteLine("No Exception occured!!!")
        Catch ioore As IndexOutOfRangeException
            Console.WriteLine("Exception : Index is Out Of Range")
        Finally
            Console.WriteLine("Finally Block Executed!!")
            Console.ReadLine()
        End Try
    End Sub
End Module

Related Posts Plugin for WordPress, Blogger...

Engineering material

GTU IDP/ UDP PROJECT

GTU IDP/ UDP PROJECT

Patel free software download

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP