Week 11 Labs
1. Function overload:
Here you provide several versions of a function. The name of the function is EXACTLY the same but the parameter lists MUST be different. The return types may or may not be the same in each case. Write two versions of a findbig function. One will take an integer array as a parameter and return the largest value in the array. The other takes a String array as a parameter. It sends back the longest string in the array. You may declare the arrays as fields at the top of your form:
Dim numbers as integer()={10,600,-888.44,77,999,10000,2}
Dim names as String()={“bob”,”long string……”,”mary”,”sue”,”joe”}
2. Function or procedure optional arguments:
Convert the code you wrote for the first lab exercise into an example of optional arguments. Pass two optional array arguments to a sub. If the first argument is empty, use the second. If both arguments are provided, or both are missing, display a message box “error”. Otherwise, find and display in a textbox either the largest integer or longest string.