: Hi if anyone can help me with these 4 functions I woud be very grateful.
: Have to write functions as well as make program run in Visual Basic.
: A. Write a private function that takes 2 surnames as arguments, and returns 1 if the
: surnames are equal, or 0 if unequal. Be careful to match cases.
: B. Write a public function named IsInRange(), which takes one numeric argument, and
: returns a Boolean value depending on whether that arguments value is within the inclusive
: range 100 to +100.
: C. Write a function which takes 2 integer arguments (say p and q), and returns 1 if p is a
: factor of q, otherwise returns 0. For example, if the functions arguments were (4, 20) then
: the function would return 1 because 4 is a factor of 20.
: D. Write a function that takes hours worked and rate of pay as arguments, and returns the
: amount due. Using this function, create a program whose purpose is to calculate and
: display the total pay (i.e. the amount due) to an employee after that employee has entered
: his/her name, payroll number, and other necessary details through text boxes.
: Thanks Very Much
Private Function IsFactor(ByVal p As Integer, ByVal q As Integer) As Boolean
IsFactor = (q = Fac(p))
Private Function Fac(ByVal Num As Integer) As Long
Dim i As Integer
If Num < 0 Then Exit Function
Fac = 1
For i = 1 To Num
Fac = Fac * i
Private Function CompareSurnames(ByVal Sur1 As String, ByVal Sur2 As String) As Integer
CompareSurnames = IIf(StrComp(Sur1, Sur2, vbBinaryCompare) = 0, 0, 1)
Public Function IsInRange(ByVal ValueToTest As Long) As Boolean
IsInRange = (ValueToTest <= 100 And ValueToTest >= -100)
Private Function GetAmountDue(ByVal Hours As Single, ByVal RateOfPay As Single) As Single
GetAmountDue = Hours * RateOfPay
this should work..
And next time you should TRY to write this youself.
Don't take life too seriously anyway you won't escape alive from it!