Hi attachment is my Assignment. I have written a program for finding the roots for quadratic equation in visual basic.Net, I need the FLOW CHART for the program i wrote. Also, I want to double check my GUI design table and see if everything is right.
Computer Programming & Numerical Methods (program to find Roots for a Quadratic Equation) Question: Draw the FLOW CHART for the following program which I made with Visual Basic.Net. The program can be used to find the Roots for a Quadratic Equation? Program Objective: The purpose of the project is to get values by entering the function. The user can solve the quadratic equation by entering the function. This program calculates roots for the function that the user puts into the input box in form of (a) x^2 +/- (b) x +/- (c). There should be two roots, x, because once is calculated once with + and once with -.When the value inside √ is negative, the program will represent the roots in the form of (real value) + (imaginary value) and the imaginary value is indicated by “i”. GUI Interface design: Control type Property 1(input) Textbox F(x) Name: val_F 2(output) Textbox a Name: val_a 3(output) Textbox b Name: val_b 4(output) Textbox c Name: val_c 5(output) Textbox x1 Name: val _x1 6(output) Textbox x2 Name: val_x2 11 Button Calculate 12 Button Clear 13 Button Cancel 14 Form Form 1 Source Code: Public Class Form1 Private Property real As Double Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click End Sub Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click End Sub Private Sub Val_F_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Val_F.KeyPress If Asc(e.KeyChar) = 13 Then Dim Parameter As String Dim Partb As String Dim Partc As String Dim Position1 As Integer Dim Position2 As Integer Position1 = InStr(Val_F.Text, "x^2") Parameter = Mid(Val_F.Text, 1, Position1 - 1) Position2 = InStr(Position1 + 4, Val_F.Text, "x") Partb = Mid(Val_F.Text, Position1 + 3, Position2 - Position1 - 3) Partc = Mid(Val_F.Text, Position2 + 1) Val_a.Text = Parameter Val_b.Text = Partb Val_c.Text = Partc End If End Sub Private Sub Calculate_Click(sender As Object, e As EventArgs) Handles Calculate.Click Dim a As Double Dim b As Double Dim c As Double Dim x1 As Double Dim x2 As Double a = Val(Val_a.Text) b = Val(Val_b.Text) c = Val(Val_c.Text) Dim chk As Double Dim imaginary As Double chk = b ^ 2 - 4 * a * c If a = 0 Then x1 = -c / b Val_x1.Text = Str(x1) Val_x2.Text = "repeated root" Exit Sub Else Val_x1.Text = Str(x1) Val_x2.Text = "repeated root" End If If chk < 0 then real = -b / (2 * a) imaginary = math.sqrt(math.abs(chk)) / (2 * a) val_x1.text = str(real) + "+" + str(imaginary) + "i" val_x2.text = str(real) + "-" + str(imaginary) + "i" exit sub else x1 = (-b + math.sqrt(chk)) / (2 * a) x2 = (-b - math.sqrt(chk)) / (2 * a) end if val_x1.text = str(x1) val_x2.text = str(x2) end sub private sub clear_click(sender as object, e as eventargs) handles clear.click val_a.clear() val_b.clear() val_c.clear() val_x1.clear() val_x2.clear() val_f.clear() end sub private sub cancel_click(sender as object, e as eventargs) handles cancel.click end end sub private sub form1_load(sender as object, e as eventargs) handles mybase.load end sub private function imaginary() as object throw new notimplementedexception end function running results: 0="" then="" real="-b" (2="" *="" a)="" imaginary="Math.Sqrt(Math.Abs(chk))" (2="" *="" a)="" val_x1.text="Str(real)" +="" "+"="" +="" str(imaginary)="" +="" "i"="" val_x2.text="Str(real)" +="" "-"="" +="" str(imaginary)="" +="" "i"="" exit="" sub="" else="" x1="(-b" +="" math.sqrt(chk))="" (2="" *="" a)="" x2="(-b" -="" math.sqrt(chk))="" (2="" *="" a)="" end="" if="" val_x1.text="Str(x1)" val_x2.text="Str(x2)" end="" sub="" private="" sub="" clear_click(sender="" as="" object,="" e="" as="" eventargs)="" handles="" clear.click="" val_a.clear()="" val_b.clear()="" val_c.clear()="" val_x1.clear()="" val_x2.clear()="" val_f.clear()="" end="" sub="" private="" sub="" cancel_click(sender="" as="" object,="" e="" as="" eventargs)="" handles="" cancel.click="" end="" end="" sub="" private="" sub="" form1_load(sender="" as="" object,="" e="" as="" eventargs)="" handles="" mybase.load="" end="" sub="" private="" function="" imaginary()="" as="" object="" throw="" new="" notimplementedexception="" end="" function="" running=""> 0 then real = -b / (2 * a) imaginary = math.sqrt(math.abs(chk)) / (2 * a) val_x1.text = str(real) + "+" + str(imaginary) + "i" val_x2.text = str(real) + "-" + str(imaginary) + "i" exit sub else x1 = (-b + math.sqrt(chk)) / (2 * a) x2 = (-b - math.sqrt(chk)) / (2 * a) end if val_x1.text = str(x1) val_x2.text = str(x2) end sub private sub clear_click(sender as object, e as eventargs) handles clear.click val_a.clear() val_b.clear() val_c.clear() val_x1.clear() val_x2.clear() val_f.clear() end sub private sub cancel_click(sender as object, e as eventargs) handles cancel.click end end sub private sub form1_load(sender as object, e as eventargs) handles mybase.load end sub private function imaginary() as object throw new notimplementedexception end function running results:>