Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Gray Code Research Task This lesson you will be working on your independent learning and research skills. You need to answer the following questions, stating the URL(s) of the sites where you found your information for each question. You have 30 minutes to complete this task! Exercise: Gray Code Explain how Gray Code works: Explain why we might want to use Gray Code. What piece of hardware found in a PC uses Gray code? Complete the following sequence of Gray Code states: 0 = 000 1 = 001 2 = ... 3 = ... 4 = ... 5 = 111 6 = 101 7 = 100 Task 2 – Programming! Copy the following code in to a new vb.net console program: Module Module1 Your first task is to annotate the code to explain what is happening. Sub Main() Dim binaryarray(3) As Integer Dim i As Integer Dim answer As Integer Dim binarystring As String Then edit the code to work with 8bit binary numbers, instead of 4 bit binary numbers. answer = 0 binarystring = "" For i = 1 To 4 Console.WriteLine("Enter binary number - digit " & i) binaryarray(4 - i) = Console.ReadLine Next For i = 0 To 3 If binaryarray(i) = 1 Then answer = answer + 2 ^ i End If Next For i = 0 To 3 binarystring = binarystring & binaryarray(3 - i) Next Console.WriteLine(binarystring & " in base 2 is " & answer & " in base 10") Console.ReadLine() End Sub End Module