Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 4: Reading values at regular time intervals . This program will use the files provided below. They are an updated version of the files

Program 4: Reading values at regular time intervals . This program will use the files provided below. They are an updated version of the files produced in program 2. Each file still contains character-integer pairings, the difference is that each of those pairings has been transformed to incorporate a simple parity error detection system. Please note that the data in the included file was stored using this struct: struct data { char chr; short cnt; }; Please use this struct as the basis for your read for this program. Like program 3, this program should read the character-integer pairs from the "image.dat" file, then display the data read in two forms. The first form is the character - integer pairing and should be displayed as (character, integer). The other form can be thought of as the pairings decoded form; the character - integer pairing ('b',6) would be decoded as 'bbbbbb'. There are few added requirements for program 4: this program should read one character-integer pair every second. this program should compute the parity of each pair and report any pairs with odd parity. Parity for this program will be computed as the total number of bits set to 1 in the binary representations of both the character and the integer. this program will need to transform the character-integer pair into its original value before displaying it. The character-integer pairs have been transformed to incorporate a simple parity error detection system. Simple parity systems like this one utilize a bit count to determine if the data has been corrupted or might be untouched. For this program, we will use a simple even-odd parity scheme; this scheme works as follows: count the total number of bits set to 1 in the binary representations of both the character and the integer double the integer if the total number of bits is odd, add 1 to the new value Your program isn't required to create data using the above system, merely to compute the parity of the provided data and display either an error message or the translated data.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions