id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com disco > hammingEncode
prev  |  next  |  chance

Write a method hammingEncode to encode a binary message using the hamming scheme. Read 4 bits m1, m2, m3, and m4 represented as ints (1 or 0) and return the 7 bits m1, m2, m3, m4, p1, p2, p3 as a single String in that order (not the Hamming order). See https://www.cs.princeton.edu/courses/archive/spring19/cos126/assignments/hamming/ for more information or https://en.wikipedia.org/wiki/Hamming(7,4)


hammingEncode(1, 1, 0, 1) → "1101100"
hammingEncode(1, 0, 1, 1) → "1011010"
hammingEncode(0, 0, 0, 0) → "0000000"

...Save, Compile, Run (ctrl-enter)

public String hammingEncode(int m1, int m2, int m3, int m4) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy