• 26th October 2011

    Quadratic Equation Solver

    This report shows the funcionality of the Quadratic Equation Solver created using Visual basic.

    Three functions were created for this project:

    The Discriminator part call Disc.

    Two for the quadratic formula:

    -QuadraticEqcPluss;(-b+(sqr(b^2-(4*a*c))))/(2*a)

    -QuadraticEqcMinus;(-b-(sqr(b^2-(4*a*c))))/(2*a)

    Those may not be required in this case but if we were using this program as part of a bigger project will be helpful to have this individual function to be call at any time. In any case it demonstrated the ability and usability of Function created by the programmer.

    Quadratic Equation

    Onload
    Onload form1/frmQuadratic is centre in the middle of the screen, and we call another method call SetProperties.

    SetProperties
    In SetProperties; we set the alignment for text boxes and the result displays, set the tab index and set the font for solution boxes since the text is been set in properties for the rest, figure above show the properties menu.

    Three command buttons as displayed in figure below; cmdSolver, cmdClear and cmdQuit.

    cmdSolve
    The command cmdSolver contains most of the code related to the quadratic equations and its different possible results/roots. It begins checking the value for three text boxes for the coefficients inputs, if the boxes have some valid information; no letters or symbols it will continue; to archived this it is use “If not isNumberic()” which check the data in case if is not a number. Different messages will be display for the different cases: above you can see “vbCritical” as a result of missing values and figure below for the numeric check a more subtle “vbInformation”. Those use different Icons which display information images to support the text messages.

    The next two images show examples of two coefficients values equal to zero; in both these cases a form which contain a label with the information and the solution; “x=0”

    The quadratic equation solver not only solves the equation but also indicated the type of root: real and different, real and equal and imaginary like in the next image. Those are display in the grpSolution.
    There are other display cases in case using a different formula; in the case of “x = ± √-c/a Imaginary”, this will also be displayed in the group solution text.

    cmdClear
    Call Initialise method Initialise clear all text boxes, group solution and sent focus to first box this case A/txtAnum.

    cmdQuit
    It has been created a simple message box; it will display a question yes/no.

    -Yes, will close the program.

    -No, would take you back to the Quadratic
    Solver, initialise.

    This is the only case that Form1/frmQuadratic has been hiden.

    Help menu
    Help menu contains About and Quadratic Equation, Both give extra information about the software. The image below display the Form 4/frmAbout with the relevant About information, both cases use the same form the only differentiates from the information contained in lblAboutText.

    The program is has been created in visual studio 2010 and then convert to visual studio 2008. The research has been carried out using different resources from the internet and books.