Question: Please help! Write a simple program in C# that can be run on Windows Command prompt given the following specification: This program will be able

Please help! Write a simple program in C# that can be run on Windows Command prompt given the following specification:

This program will be able to encode a message by inserting hamming bits and decode an encoded message to detect and fix a corrupt message. Name the program as as hamming.cs which will take two command line parameters (-encode or --decode) and message (as binary string). You must validate the input (-d, -de, -dec, -deco, etc. are all valid and similarly, -encode, -encod, -enco, -enc, etc. are all valid). The binary string must be validated to ensure that it contains only binary digits. The binary string must be at least 7 characters and at most 32 characters long (32 zeros and ones in the input string).

The following are some sample input: C:\> hamming -e 1001011

Given message: 1001011

Encoded with Hamming bits: 10011010110.

C:\> hamming -d 10010111100

Single bit error detected at position 7 from right. Message corrected. Original message is: 1001111.

You must use Regular Expression to validate the input. Display appropriate error messages for invalid input. Use methods named encode [ public static string encode (string binstr) ] and decode [declaration: public static string decode (string binstr) ] for encoding and decoding the input messages. Use a method named isValidAction [declaration: public static bool isValidAction (string actstr) ] to validate action string (-e or -d, etc.) and a method named isValidBinStrInput [declaration: public static bool isValidBinStrInput (string binstr)] to validate the message to be encoded or decoded which is a binary input string. Also, use a method named DisplayUsage to format any error message that is needed to displayed along with the usage information [declaration: public static string DisplayUsage(string msg)]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!