Professional Documents
Culture Documents
Marvin D. Halog Activity 4
Marvin D. Halog Activity 4
Marvin D. Halog Activity 4
Halog
Activity 4
CODES:
#ApplicationLabel: ACTIVITY 4
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Marvin
End Sub
Sub Marvin
a = Rnd(1,20)
b = Rnd(1,20)
mar1.Text=a
mar2.Text=b
mar3.Text="+"
Result.Text=""
End Sub
Sub Activity_Resume
End Sub
End Sub
Sub BtnAction_Click
If Result.Text="" Then
Else
checkresult
End If
Else
Marvin
btnaction.Text="O K"
End If
End Sub
Sub checkresult
If Result.Text=a+b Then
mar_comment.Text="Well Done"
btnaction.Text="View"
Else
mar_comment.Text="Invalid"
End If
End Sub
Addition
Subtraction Output:
Subtraction Code:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
Public a,b As Int
'These global variables will be redeclared each time the activity is created.
Private btnaction As Button
Private mar_comment As Label
Private mar1 As Button
Private mar2 As Button
Private mar3 As Button
Private Result As EditText
End Sub
Sub Marvin
a = Rnd(1,20)
b = Rnd(1,20)
mar1.Text=a
mar2.Text=b
mar3.Text="-"
Result.Text=""
End Sub
Sub Activity_Resume
End Sub
End Sub
Sub BtnAction_Click
If btnaction.Text="O K" Then
If Result.Text="" Then
ToastMessageShow("Invalid", "Try again")
Else
checkresult
End If
Else
Marvin
btnaction.Text="O K"
End If
End Sub
Sub checkresult
If Result.Text=a+b Then
mar_comment.Text="Well Done"
btnaction.Text="View"
Else
mar_comment.Text="Invalid"
End If
End Sub
Multiplication Output:
Multiplication Code:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
Public a,b As Int
'These global variables will be redeclared each time the activity is created.
Private btnaction As Button
Private mar_comment As Label
Private mar1 As Button
Private mar2 As Button
Private mar3 As Button
Private Result As EditText
End Sub
Sub Marvin
a = Rnd(1,20)
b = Rnd(1,20)
mar1.Text=a
mar2.Text=b
mar3.Text="*"
Result.Text=""
End Sub
Sub Activity_Resume
End Sub
End Sub
Sub BtnAction_Click
If btnaction.Text="O K" Then
If Result.Text="" Then
ToastMessageShow("Invalid", "Try again")
Else
checkresult
End If
Else
Marvin
btnaction.Text="O K"
End If
End Sub
Sub checkresult
If Result.Text=a+b Then
mar_comment.Text="Well Done"
btnaction.Text="View"
Else
mar_comment.Text="Invalid"
End If
End Sub
Division Output
Division Code
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
Public a,b As Int
'These global variables will be redeclared each time the activity is created.
Private btnaction As Button
Private mar_comment As Label
Private mar1 As Button
Private mar2 As Button
Private mar3 As Button
Private Result As EditText
End Sub
Sub Marvin
a = Rnd(1,20)
b = Rnd(1,20)
mar1.Text=a
mar2.Text=b
mar3.Text="/"
Result.Text=""
End Sub
Sub Activity_Resume
End Sub
End Sub
Sub BtnAction_Click
If btnaction.Text="O K" Then
If Result.Text="" Then
ToastMessageShow("Invalid", "Try again")
Else
checkresult
End If
Else
Marvin
btnaction.Text="O K"
End If
End Sub
Sub checkresult
If Result.Text=a+b Then
mar_comment.Text="Well Done"
btnaction.Text="View"
Else
mar_comment.Text="Invalid"
End If
End Sub