Overall Requirements Write two programs encode.toy and decode.toy. Each TOY instruction must have corresponding pseudocode. (This is auto-generated by Visual X-Toy – see below.) It's also good practice to add line breaks between logically related "sections" of TOY code and write a comment above each "section" explaining what that code does. encode.toy Write a TOY program encode.toy

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 8PP: (Statistical) In many statistical analysis programs, data values considerably outside the range of...
icon
Related questions
Topic Video
Question

Overall Requirements

  • Write two programs encode.toy and decode.toy.
  • Each TOY instruction must have corresponding pseudocode. (This is auto-generated by Visual X-Toy – see below.) It's also good practice to add line breaks between logically related "sections" of TOY code and write a comment above each "section" explaining what that code does.

encode.toy

Write a TOY program encode.toy to encode a binary message using the scheme described above. Repeatedly read four (4) bits m1m2m3m4 from TOY standard input and write the seven (7) bits m1m2m3m4p1p2p3 to TOY standard output. Stop upon reading FFFF from standard input.

  • p1 = m1 ^ m2 ^ m4
  • p2 = m1 ^ m3 ^ m4
  • p3 = m2 ^ m3 ^ m4

Recall that ^ is the exclusive or operator in Java and TOY. This captures the parity concept described above.

decode.toy

Write a TOY program decode.toy to decode and correct a Hamming encoded message. Repeatedly read seven (7) bits m1m2m3m4p1p2p3 from TOY standard input and write the four (4) correct bits m1m2m3m4 to TOY standard output. Stop upon reading FFFF from standard input. Recall, to determine which one, if any, of the message bits is corrupted, perform the parity checks:

  • p1 = m1 ^ m2 ^ m4
  • p2 = m1 ^ m3 ^ m4
  • p3 = m2 ^ m3 ^ m4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning