1 Given Binary Code Determine Number Errors Detect Number Errors Correct Write Program Pyt Q37122946

1. Given a binary code, determine the number of errors that itcan detect and the number of errors that it can correct. WRITE APROGRAM PYTHON or JAVA. both would be nice


Answer


package Networking;

import java.util.*;

public class ErrorDectCorrect

{

static int setParityBit(int data[])

{

// Initializing count to zero which will count the number of1.

int counter = 0;  

// Loops till data length

for(int c = 0; c < data.length; ++c)

// Increase count if value in array “data” is 1.

if(data[c] == 1)

++counter;

// Returns 0 if counter value is even number (even number of1s)

if((counter % 2) == 0)

return 0;

// Otherwise returns 1 for odd number of 1

else

return 1;

}//

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.