I need to include the key words Try, catch, and Finally. The code must show the correct answer or if there is an error the code must show an error code. I am not sure where to add the key words to make this function correctly.
Module Module1
Sub Main()
Dim side_of_cube, volume_ofcube As Double
Console.Write("Enter value of side of cube: ")
side_of_cube = Double.Parse(Console.ReadLine())
volume_ofcube = side_of_cube * side_of_cube * side_of_cube
Console.WriteLine("Value of volume of cube: " & volume_ofcube)
Console.WriteLine()
Shell("cmd /c pause", AppWinStyle.NormalFocus, True)
End Sub
End Module
My guess is:
Sub Main()
Dim side_of_cube, volume_ofcube As Double
Console.Write("Enter value of side of cube: ")
side_of_cube = Double.Parse(Console.ReadLine())
Try
volume_ofcube = side_of_cube * side_of_cube * side_of_cube
Catch volume_ofcube
Console.WriteLine("Value of volume of cube: " & volume_ofcube)
Finally
Console.WriteLine()
Shell("cmd /c pause", AppWinStyle.NormalFocus, True)
End Sub
End Module