Your Glorious Instructor has assigned you the task of creating an application fo
ID: 665629 • Letter: Y
Question
Your Glorious Instructor has assigned you the task of creating an application for testing Complex Numbers. If you've not had Calculus III, a complex number is a pair of real numbers (a,b) upon which we define addition and multiplication in the following fashion for two complex numbers c and d:
You use Visual Studio to create a form for your test application that looks like this:
Assume that for the complex number X, the text box for the real portion of the number is named reXTextBox and the text box for the imaginary portion is named imgXTextBox. For the complex number Y, the text boxes are named reYTextBox and imgYTextBox. The two buttons are named addButton and multiplyButton. Write the c# code behind for event handlers for each button. Put the result back into the text boxes for the complex number X.
Explanation / Answer
Code For Addition and Multiply of complex no
Public Class ComplexNumber
Public realNo As Integer
Public imag As Integer
Public Function calctn(C1 As COmplexNumber, C2 As COmplexNumber,ByVal optr as string) As COmplexNumber
Dim result As New COmplexNumber
if (optr ="+") then
result.realNo = (C1.realNo + C2.realNo)
result.imag = (C1.imag + C2.imag)
else if (optr ="*") then
result.realNo = (C1.realNo * C2.realNo)
result.imag = (C1.imag * C2.imag)
end if
calctn = result
End Function
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.