Marvin D. Halog Activity 4

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Marvin D.

Halog

Activity 4
CODES:

#Region Project Attributes

#ApplicationLabel: ACTIVITY 4

#VersionCode: 1

#VersionName:

'SupportedOrientations possible values: unspecified, landscape or portrait.

#SupportedOrientations: unspecified

#CanInstallToExternalStorage: False

#End Region

#Region Activity Attributes

#FullScreen: False

#IncludeTitle: True

#End Region

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 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

Sub Activity_Pause (UserClosed As Boolean)

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

OUTPUT BETWEEN THE MOBILE DEVICE AND PERSONAL COMPUTER

Addition
Subtraction Output:

Subtraction Code:

#Region Project Attributes


#ApplicationLabel: ACTIVITY 4
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes


#FullScreen: False
#IncludeTitle: True
#End Region

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 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

Sub Activity_Pause (UserClosed As Boolean)

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:

#Region Project Attributes


#ApplicationLabel: ACTIVITY 4
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes


#FullScreen: False
#IncludeTitle: True
#End Region

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 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

Sub Activity_Pause (UserClosed As Boolean)

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

#Region Project Attributes


#ApplicationLabel: ACTIVITY 4
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes


#FullScreen: False
#IncludeTitle: True
#End Region

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 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

Sub Activity_Pause (UserClosed As Boolean)

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

You might also like