ANSWER WANTED IN JAVA FOR NETBEANS. NOT C++. Write a program to implement the ch
ID: 3768405 • Letter: A
Question
ANSWER WANTED IN JAVA FOR NETBEANS. NOT C++.
Write a program to implement the checksum method.
The implementation has two parts:
a. Calculating the checksum at the sender
b. Verifying the checksum at the receiver
Calculating the checksum at the sender :
Inputs: 4 data each consisting of 16-bit (binary)
Output: Checksum of 16-bit (binary)
Example: http://mathforum.org/library/drmath/view/54379.html
Verifying the checksum at the receiver Inputs:
4 data each is consisting of 16-bit and their 16-bit checksum
Output: Checksum for 4 data each is consisting of 16-bit and their 16-bit checksum
If checksum is equal to 0s, your data is not corrupted
If checksum is not equal 0s, your data is corrupted
Explanation / Answer
public static void main(String[] args) throws Exception
{
String a = "1010000001000011";
String b = "1111100101001111";
String c = "1111111111101110";
String d = "1110101011111110";
int aa = Integer.parseInt(a, 2);
int bb = Integer.parseInt(b,2);
int cc = Integer.parseInt(c,2);
int dd = Integer.parseInt(d,2);
int f = aa + bb + cc + dd;
Integer.toBinaryString(f)
while (f!=0)
{
int digit = f%2;
buf.append(digit);
f=f/2;
}
buf.reverse();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.