Activity 1: Create a Windows application to perform the following functionalities.
A) Create an array that contains the names of the months of the year.
B) Using For...Each loop, write code G display the names of the months.
C) Create a second array to store the number of days of corresponding months (ignore leap-years) of first array.
D) Request a month from the user and use "For...loop" to display the number of days for that month.
E) Request a month from the user, delete number of days for that specified month and display the deleted value by using "Do...While loop".
Activity2: Create a Windows application to perform the following functionalities.
An office building has two floors (0 to 1), each of which has four offices (0 to 3). Each office occupied by one person.
A) Declare an array to store the names of occupants for each office.
B) Write code to store fictitious names in that array.
C) Write a short routine to display the occupants of each office along with the corresponding floor and office number.
D) Write a function to display the occupants for the requested office. Use "If...Then" statement to check the existence of that office.
Activity 3: Use Linear Search technique and complete the following function to find the position of the number 55 from the following array. Create a Windows application to display the position.
17
|
23
|
31
|
47
|
55
|
62
|
69
|
74
|
88
|
Public Function LinearSearch() As Interger()
Dim target as integer = ................................. the element to search for
Dim s() as integer = ................................. the array to be searched
Dim last as integer = ................................. the last position of the array
Dim pos as integer = ................................. the middle position of the array
If (last < 0)
Return - 1
End if
while ((.................................) And (.................................))
pos+=1
if ((.................................) And (.................................))
return pos we found it
else
return-1 we didn't find it
end if
end while
Activity 4: Use Binary Search technique and complete the following function to find the position of the number 29 from the following array. Create a Windows application to display the position.
9
|
15
|
22
|
29
|
36
|
54
|
55
|
61
|
70
|
73
|
88
|
Public function BinarySearch() As Integer()
Dim target, first, last, mid As Integer 'Declare all variables
Target = ................................. the element to search for
first = ................................. the fast position of the array
last = ................................. the last position of the array
Dim s() As Integer = ................................. the array to be searched
While (first <= last)
mid = ................................. /2
If (.................................) Then
Return .................................
Exit While
Else
If (.................................) Then
Last = .................................
Else
first = .................................
End If
End If
End While
Return - 1End Function
Activity 5: Use editor provided test tools, create and execute/run test case for each activity. Finally, test result will be attached with the assessment.