> I thought I knew what I was supposed to do but I have absolutely no > clue! I have no idea on what to write as code or how to begin? I was > reading through the course package and I don't know what or how to > initialize the properties of slected controls? I'm really stuck before > I have even begun! Please help me, Thank-you It's unfortunate that you didn't go to the lecture and tutorial this week, as we discussed assignment 2 in great detail. You don't have to initialize any controls because that part of the assignment has already been completed for you. You need to download the three files from the web page and open up the project file in Visual Basic. Double click on the CONVERT button, and add the code for each function. Make sure that the last line for each function assigns a value to the name of the function, so that the function returns a value. The total amount of code required for this assignment is not a lot. You'll need about 10-15 lines of code for each of Bin2Dec, Oct2Dec, Dec2Bin, and Dec2Oct, and 3 lines of code for each of Oct2Bin and Bin2Oct. Here are instructions related to each of the six functions that you need to write for this assignment. 1. Start by writing the Bin2Dec function. You'll need to use a for loop similar to the one in Lec7-30 to go through each character of Number (instead of Text1.Text) one character at a time. If Number was "1011" then this function should return the sum of 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0 You'll need an integer variable to accumulate this total. Each time in the loop, you'll calculate one line in the above sum. You need to get the next character from Number (which will either be a "0" or a "1" as a String), use the Val function on it to convert it to a number, multiply it by 2, raised to some power (use ^ to raise a number to a power). Notice that the power is getting one smaller as you consider the digits from left to right in the number. 2. Then write the Dec2Bin function. For this function, you'll be building a string that contains the remainders. You'll also have to store the Number as an integer value, so that you'll be able to use "Mod" and "\" (integer division) on it. Take a look at how Text2.Text is used to build a new string in the example in Lec7-30. You would create your own string and append each remainder to this string in reverse order. The lecture notes on the web page for Lecture #5 explain how to reverse the order of the characters in a string that you're building (see the example that uses a string variable called Junk). Once you have finished these two functions, you have pretty much finished the whole assignment! 3. Copy the Bin2Dec function code into the Oct2Dec function and then change the 2 to an 8 in this function. 4. Copy the Dec2Bin function code into the Dec2Oct function and then change the 2 to an 8 in this function. 5. Oct2Bin and Bin2Oct should be 3 lines long each. For Oct2Bin, you can just use the two functions that you've already written ... first call Oct2Dec and then call Dec2Bin. The Oct2Bin function is passed a parameter called Number. The first line of code will be to create a String variable to hold the result of when you call Oct2Dec. In the second line, you call Oct2Dec, passing Number to it as a parameter (in the parenthesis), and you put the result into this new variable (use an assignment statement). The third line is also an assignment statement. You pass this new variable that you have created (it now holds a decimal number) to the Dec2Bin function as a parameter, and you return the result (remember, you can return a result by assigning the name of the function, i.e., Oct2Bin = ...). 6. Bin2Oct will call Bin2Dec followed by Dec2Oct. Notice that the parameter for this function is called BinaryNumber, rather than just Number like for the other five functions. Prof. Hunter andria@cdf.utoronto.ca