QuestionQuestion

Transcribed TextTranscribed Text

In this assignment, you will write three programs that involve string arrays. You will get used to comparing string characters as well as iterating through strings. You will also gain a thorough understanding of two's compliment bit storage and integer addition (1) Morse Code Write program called morseCode.c that asks the user for an English sentence and then displays the A.- Seee sentence in Morse code Each letter should be B -... K-.- T - replaced by the code shown on the right (i.e., using -.- .-.. J..- dash and dot characters) You will have to convert any -.. M-- V...- lowercase characters to upper case Also. any non- W ..- alphabetic (and non-space) characters are entered, G--. they are to be represented simply by this string "?" Y-.-- You must leave a space character between each letter Z and you should leave 3 spaces between each word. Here are a couple of sample runs of the program Enter the sentence to be converted: I LOVE C Here is your sentence in Morse Code: -.-. Enter the sentence to be converted: This sentence has 2 A's and 2 symbols Here is your sentence in Morse Code: (2) Reverse Morse Code Write program called reverseMorseCode.c that takes in morse code string sequence from the user (as produced from the program above) and converts it back into the original ASCII sentence as follows: Enter the Morse Code sequence: .-.. --- .... Here is the decoded message: LOVE Note that the spacing between the words in the finaloutput is arbitrary and may vary according to whatever you want, as long as the words come out properly. The "?' characters should stay as '?' character in the output. (3) Binary Math Write program called bitMath.c that asks the user for two 8-bit sequences that correspond to integers stored in the two's compliment representation. It should thenado the bit sequences together to produce a resulting bit sequence that is the sum of the two numbers. The program should display the bit sequences as well as their decimal value wi th output in the format shown in the the progr am was run 8 times) 00001010 sequence: (17) ./bitMath sequence: 10000000 8-bit sequence: 00000001 (-128) ./bitMath sequence: 8-bit sequences sequence: 8-bit sequence: Bit sequence 1 has Bit sequence has non-binary characters Towrite this code, it makes sense to have at least 4 functions: a main function, a function for flipping bits (for the negative numbers), a function for adding two bit sequences, and a function for converting a bit sequence to decimal value. It would be good to follow the following steps to obtain your solution systematically. Don't move on until you geteach step working 1. Get the input from the user 2. Ensure that each input sequence is 8 characters long 3. Check to ensure that there are only 1's and O's in the bit sequence 4. Display the input sequences along with their decimal equivalents (test only positive numbers) 5. Write the function to add the bit sequences and produce the result (test only positive numbers) 6. Write the function to flip the bits of a sequence 7. Adjust your code to work for negative numbers 8. Add the overflow checking 9. Test thoroughly Test your code thoroughly and hand in the output from your test cases in a file called output.tx You will be marked according to the thoroughness of your test cases Think of the tricky test cases and boundary test cases. If you miss some 'obvious" boundary test cases, you will lose marks so test more than you need if you are not certain

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

char morse_characters[26][50] = {".-","-...","-.-.","-..",".","..-.","--.", "....","..",
".---","-.-",".-..","--","-.","---",".--.","--.-",".-.",
"...","-","..-","...-",".--","-..-","-.--","--.."};


void upperCase(char sentence[]) {
   int index = 0;
   
   while (sentence[index] != '\0') {
      if (sentence[index] >= 'a' && sentence[index] <= 'z') {
         sentence[index] = sentence[index] - 32;
      }
      index++;
   }
}

void morseCode(char sentence[], char result[]) {
   int index = 0;
   
   while (sentence[index] != '\0') {
      int asci = sentence[index];
      if(asci >= 65 && asci <= 90) {
       strcat(result, morse_characters[asci-65]);
       strcat(result, " ");
      } else if(sentence[index] == ' ') {
       strcat(result, "   ");
      } else {
       strcat(result, "? ");
      }
      index++;
   }
}...

By purchasing this solution you'll be able to access the following files:
Solution.c, Solution1.c and Solution.zip.

50% discount

Hours
Minutes
Seconds
$50.00 $25.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats