We have this as our preliminary examination this first semester in our IT Elective II which is about VisualBasic.Net. Well, during our written examination, we were tasked to simulate the code written in our test papers and we also create a function according to the given problem. While in our laboratory examination, we were task to incorporate these functions in a program. So here first are the functions:
-----------------------------------------------------------------------------------------
Function reverseString(ByVal word As String) As String
Dim x As Integer
For x = 1 To Len(word)
reverseString = ChangeChar(Mid(word, x, 1)) & reverseString
Next
End Function
-----------------------------------------------------------------------------------------
The function above is about reversing a string but the other thing that it does is it fetches the data to the ChangChar function for to be able to make some modifications.
-----------------------------------------------------------------------------------------
Function ChangeChar(ByVal letter As String) As String
Select Case Microsoft.VisualBasic.UCase(letter)
Case "A"
ChangeChar = "I"
Case "B"
ChangeChar = "N"
Case "C"
ChangeChar = "F"
Case "D"
ChangeChar = "O"
Case "E"
ChangeChar = "R"
Case Else
ChangeChar = "M"
End Select
End Function
-----------------------------------------------------------------------------------------
The above code is the function called in the reverseString function. It is responsible for encrypting the data which make the data unreadable. Later, you will see some sample performed by this function.
-----------------------------------------------------------------------------------------
Function insertChar(ByVal word As String, ByVal toinsert As String) As String
Dim x As Integer
For x = 1 To Len(word)
insertChar = insertChar & toinsert & Microsoft.VisualBasic.UCase(Mid(word, x, 1))
Next
End Function
-----------------------------------------------------------------------------------------
This is also an encryption technique which adds excess data so that it will be hard to read if it is combined with the other functions above.
Here is the sample input and result of performing the reverseString function. You better try it for you to understand it better.
AERIAL = MIMMRI
The Input which is "AERIAL" |
The Output after performing the reverseString function |
No comments:
Post a Comment