He folks,
This is a late xmas gift.. a very simple company value calculator. I watch Shark Tank US just to learn from these guys. especialy from Mr. Wonderful.
Enjoy:
This is a late xmas gift.. a very simple company value calculator. I watch Shark Tank US just to learn from these guys. especialy from Mr. Wonderful.
Enjoy:
Company calculator:
#Region Project Attributes
#ApplicationLabel: Calculate Company Value
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#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
'These global variables will be redeclared each time the activity is created.
Private EditText1 As EditText
Private EditText2 As EditText
Private EditText3 As EditText
Private Button1 As Button
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private ButtonClear As Button
Private Label4 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
' Variables to hold input values and the result
Dim amountRequested As Double
Dim equityPercentage As Double
Dim valuation As Double
' Get inputs from EditText1 and EditText2
Try
amountRequested = EditText1.Text ' Amount requested
equityPercentage = EditText2.Text / 100 ' Convert percentage to decimal (e.g., 10 -> 0.10)
Catch
ToastMessageShow("Please enter valid numeric values.", False)
Return
End Try
' Validate inputs
If equityPercentage <= 0 Or amountRequested <= 0 Then
ToastMessageShow("Both inputs must be greater than 0.", False)
Return
End If
' Calculate the company valuation
valuation = amountRequested / equityPercentage
' Update EditText1 and EditText2 to include dollar sign and percentage
EditText1.Text = "$" & NumberFormat(amountRequested, 1, 2) ' Format amount with dollar sign
EditText2.Text = NumberFormat(equityPercentage * 100, 1, 2) & "%" ' Format equity with percentage sign
' Display the valuation result in EditText3 with a dollar sign
EditText3.Text = "$" & NumberFormat(valuation, 1, 2) ' Format valuation with dollar sign
End Sub
Sub ButtonClear_Click
'Clear all EditText boxes
EditText1.Text = ""
EditText2.Text = ""
EditText3.Text = ""
'ToastMessageShow("All fields cleared.", False) ' Optional feedback message
End Sub