Roots of a quadratic: Subs

Earlier, you did the Roots of a quadratic exercise. If you haven't done it, do it now.

Rewrite it, adding error checking and Subs. It should work like this:

Some of the code has been written for you. Download the workbook. You'll see code like this:

  1. Sub computeRoots(a As Single, b As Single, c As Single, _
  2.         root1 As Single, root2 As Single, imaginaryRoots As Boolean)
  3.     'Check for imaginary roots.
  4.     If (b * b - 4 * a * c) < 0 Then
  5.         'Imaginary.
  6.  
  7.     Else
  8.         'Real (not imaginary).
  9.  
  10.     End If
  11. End Sub
Complete the program. Do not change any of the existing code. Remember to use the flag pattern.

Upload your solution.

In the text part of the submission form, please answer the question: What did you learn from this exercise?

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Referenced in: 
Attachments: