Question: Visual Basic Windows Forms Application for polynomial calculators I mostly need help executing my calculate button for this application. My code, GUI, and instructions are
Visual Basic Windows Forms Application for polynomial calculators
I mostly need help executing my calculate button for this application. My code, GUI, and instructions are below
Public Class MainForm
Private Sub ExitButton_Click(sender As Object, e As EventArgs) Handles ExitButton.Click Me.Close() End Sub
Private Sub RadButnConst_CheckedChanged(sender As Object, e As EventArgs) Handles RadButnConst.CheckedChanged If RadButnConst.Checked = True Then TextBoxA.Visible = False TextBoxB.Visible = False TextBoxC.Visible = True TextBoxA.Text = "" TextBoxB.Text = "" TextBoxC.Text = "" LabelResult.Text = "" End If End Sub
Private Sub RadButnFirst_CheckedChanged(sender As Object, e As EventArgs) Handles RadButnFirst.CheckedChanged If RadButnFirst.Checked = True Then TextBoxA.Visible = False TextBoxB.Visible = True TextBoxB.Visible = True TextBoxA.Text = "" TextBoxB.Text = "" TextBoxC.Text = "" LabelResult.Text = "" End If If TextBoxB.Text = "0" Then MessageBox.Show("Error: B cannot be zero!") End If
End Sub
Private Sub RadButnSecond_CheckedChanged(sender As Object, e As EventArgs) Handles RadButnSecond.CheckedChanged If RadButnSecond.Checked = True Then TextBoxA.Visible = True TextBoxB.Visible = True TextBoxB.Visible = True TextBoxA.Text = "" TextBoxB.Text = "" TextBoxC.Text = "" LabelResult.Text = "" End If If RadButnSecond.Checked = True Then If TextBoxA.Text = "0" Then MessageBox.Show("Error: A cannot be zero!") Else If TextBoxA.Text = "" Then MessageBox.Show("Enter a value for A") End If If TextBoxB.Text = "" Then MessageBox.Show("Enter a value for B") End If If TextBoxC.Text = "" Then MessageBox.Show("Enter a value for C") End If If TextBoxA.Text.IndexOf(".") = -1 Then MessageBox.Show("Error: A cannot be a decimal") End If End If End If
End Sub
Private Sub LabelResult_Click(sender As Object, e As EventArgs) Handles LabelResult.Click
End Sub
Private Sub CalculateButton_Click(sender As Object, e As EventArgs) Handles CalculateButton.Click
End Sub
Private Sub TextBoxA_TextChanged(sender As Object, e As EventArgs) Handles TextBoxA.TextChanged
End Sub
Private Sub TextBoxB_TextChanged(sender As Object, e As EventArgs) Handles TextBoxB.TextChanged
End Sub
Private Sub TextBoxC_TextChanged(sender As Object, e As EventArgs) Handles TextBoxC.TextChanged
End Sub End Class

I am writing an application that will generate and output the root(s) for constant polynomials (including the zero polynomial), first-degree polynomials, and second-degree polynomials depending on the users selection from a group box containing three radio buttons, one for each type of equation. The program must take as input one to three integer coefficients: a,b, and c and, depending on the selected radio button, use either the quadratic formula, the linear formula, or the zero polynomial definition to find and report the real roots of the equation, if there are any. I do not want to report any complex conjugate roots.
If the discriminant of a quadratic is 0 then there is 1 real root; positive then there are 2 real roots; and negative then there are no real roots.
| Radio Button | Text Boxes | Output |
| Constant | Only one for C | "None" if c0 else "Infinite" |
| First degree | Two: B and C | Root on top line |
| Second degree | Three: A,B, and C | "None" if there are no real roots, OR the single root on top line, OR both roots each on own line |
The square root function must be used for quadratic formula.
Only integer values can be accepted as input for the coefficients. There must be a test for no input (i.e. an empty string in a text boxs Textproperty). A no input condition must generate a message box that states that values must be supplied for all coefficients. If a coefficient is zero, then a zero must be entered. No exception handling is allowed on the call to CInt (used to convert the text box Text propertys string to an integer coefficient). The conversion must always be successful. Rather string methods must be used to test for numeric input and for integer input. If any of the above tests fail, the error message given the user must specifically state which coefficient ('a', 'b', or 'c') has experienced what kind of data entry error and keyboard focus must be moved into the text box that exhibited the error.
Constant tests
| c | output |
| 4 | none |
| 0 | infinite |
Linear Tests
| B | C | Output |
| 6 | -3 | 0.5000 |
| 1 | 2 | -2.0000 |
Quadratic Tests
| A | B | C | Output |
| -1 | 2 | -1 | 1.0000 |
| 1 | 5 | 28 | None |
| 1 | -11 | 28 | 7.0000 4.0000 |
Polynomial Root Finder Polynomial Type O Constant OFirst Degree O Second Degree Coefficient A- coefficient B= coefficient C= Y(x) Calculate Clear Exit Polynomial Root Finder Polynomial Type O Constant OFirst Degree O Second Degree Coefficient A- coefficient B= coefficient C= Y(x) Calculate Clear Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
