Click to follow our Afritutor YouTube Channel, subscribe and click notifications and get updates on new learning videos
<=Back
A student created the following visual basic program to determine the roots of the quadratic equations. Use it to answer the question that follows.
Private sub command1_click ()
Dim a, b, c, d, x1, x2
a= Val (Text1. Text)
b= Val (Text1. Text)
c= Val (Text1. Text)
d= (b ^ 2 – 4 * a * c)
x1= (-b + Sqrt(d)) / (2*a)
x2= (-b - Sqrt(d)) / (2*a)
Text4. Text = str(x1)
Text5. Text = str(x2)
End sub
Rewrite the program to include an error handler with error code 5 and 6 to test for the division by zero and Square root of a negative number respectively. When activated, error handler displays a more descriptive error message. (5 marks)
 Viewed: 114 times For Better experience and learning,for video answers, after video ends playing, click next question in the questions list!!!
Share in: