Artifact J-1: Codeword Parity Validator

Description

A program that tells the user if a parity-encoded word is valid or not, and if a Hamming codeword is valid or not.

A parity-encoded word is a series of binary digits (zero or one) where the left most digit is either a zero or one depending on the type of parity being used (EVEN or ODD). If a word is encoded with EVEN parity the number of one bits must be an even number. If a word is encoded with ODD parity the number of one bits must be an odd number.

For example, if the original word is: 100

  • EVEN codeword is 1100 (1 + 1 is 2, an even number)
  • ODD codeword is 0100 (1 is an odd number)

A Hamming encoded word is a series of binary digits (zero or one) where the 2x bits are either a zero or one depending on the type of parity being used (EVEN or ODD)

For example, if the original word is: 10

  • EVEN codeword is 11100
  • ODD codeword is 00110

For more information on parity checking read: http://en.wikipedia.org/wiki/Parity_bit.
For more information on Hamming codes read: http://en.wikipedia.org/wiki/Hamming_code.

Technical Knowledge

I applied my knowledge of:

  • Java basics including GUI classes
  • regular expressions
  • object oriented programming.

Skills Applied

I developed these skills while making this artifact:

  • working with the NetBeans IDE
  • test-driven design using NetBeans
  • object oriented programming with Java.

Notes

I wrote this for BCIT’s COMP 2526, Intermediate Java, in January 2008.

I employed an iterative, test-driven approach. My first iteration resulted in a program that checked the parity of a codeword entered as a command-line argument. The second iteration added logic to check Hamming codewords, and the third and final iteration added a GUI envelope for the program.

The application was written using NetBeans against a series of Unit tests provided by our instructor, D’Arcy Smith.

Demonstration

Download the source code [7 KB].

Download the JAR file here [21 KB]. Navigate to the download folder with your command prompt and run using:

java -jar Parity_Validator_3.jar

Share