I always get naN value/Result. Is there something wrong with my computation. help me guys thanks. :sign0104:
attached is my project file and formula/equation
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim texta As Int
Dim textb As Int
Dim textc As Int
Dim quadratic As Double
Dim equation1 As Double
Dim equation2 As Double
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim clearbutton As Button
Dim EditTexta As EditText
Dim EditTextb As EditText
Dim EditTextc As EditText
Dim Label1 As Label
Dim Label2 As Label
Dim Label3 As Label
Dim Label4 As Label
Dim Label5 As Label
Dim Label6 As Label
Dim lblroot1 As Label
Dim lblroot2 As Label
Dim quitbutton As Button
Dim solvebutton As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout ("main")
ToastMessageShow ("welcome!",False)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub quitbutton_Click
Dim quit As Int
quit = Msgbox2("Do you want to quit?","","YES","","NO",Null)
If quit = DialogResponse.POSITIVE Then
ToastMessageShow("Goodbye!",False)
Activity.finish
End If
End Sub
Sub clearbutton_Click
EditTexta.Text=""
EditTextb.Text=""
EditTextc.Text=""
End Sub
Sub solvebutton_Click
'Dim sum As Int
texta=EditTexta.Text '6
textb=EditTextb.Text '5
textc=EditTextc.Text '4
'--ROOT1
equation1= Power(textb,2) - (4 * (texta * textc)) 'b2-4ac
equation1=Sqrt(equation1)
equation1= textb - equation1
equation2=2 * texta '2a
quadratic= equation1 / equation2
lblroot1.Text=quadratic
'--ROOT2
equation1= Power(textb,2) - (4 * (texta * textc)) 'b2-4ac
equation1=Sqrt(equation1)
equation1= -textb + equation1
equation2= 2 * texta '2a
quadratic =equation1 / equation2
lblroot2.Text=quadratic
End Sub
attached is my project file and formula/equation