Starting from:

$24.99

CMSC204 Assignment 5 Solution


Assignment Description

Write the classes required to create a Morse Code Converter Utility. Your Morse Code Converter Utility will be using a generic linked binary tree with generic TreeNodes to convert Morse Code into English. There is no GUI requirement for this assignment. You are supplied a GUI for testing purposes.

Concepts tested by this assignment


Generic Classes
Utility Class (all static methods)
Linked Trees
Building a Tree for conversion purposes




Data Element - TreeNode class

Data Structure - MorseCodeTree class
A generic linked binary tree which inherits from the LinkedConverterTreeInterface.
Utility class - MorseCodeConverter
The MorseCodeConverter contains a static MorseCodeTree object and constructs (calls the constructor for) the MorseCodeTree.
This class has two static methods convertToEnglish to convert from morse code to English. One method is passed a string object (“.-.. --- ...- . / .-.. --- --- -.- ...”). The other method is passed a file to be converted. These static methods use the MorseCodeTree to convert from morse code to English characters. Each method returns a string object of English characters.
There is also a static printTree method that is used for testing purposes – to make sure the tree for MorseCodeTree was built properly.
Use the Javadoc provided to make sure that your MorseCodeConverter class follows the method headers so that the MorseCodeConverterTest will run correctly.
Testing - JUnit Test Classes
You must add at least 1 test for MorseCodeConverter.convertToEnglish(String) and at least 1 test for MorseCodeConverter.convertToEnglish(File) to the MorseCodeConverterTest class. You must create a JUnit test for your MorseCodeTree class. Include your test files with your code files.


Assi gnment Details

This is a table for the conversion from Morse Code to alpha letters.

Building the MorseCodeTree (method buildTree)
Your MorseCodeTree is a 5 level tree. Insert a mapping for every letter of the alphabet into the tree map. The root is a TreeNode with an empty string. The left node at level 1 stores letter ‘e’ (code ‘.’) and the right node stores letter ‘t’ (code ‘-‘). The 4 nodes at level 2 are ‘i’, ‘a’, ‘n’, ‘m’ (code ‘..’, ‘.-‘, ‘-.’, ‘—‘). Insert into the tree by tree level from left to right. A ‘.’ will take the branch to the left and a ‘-‘ will take the branch to the right. This is the structure of the tree.

Using the MorseCodeTree
Use the MorseCodeTree to convert Morse Code to English by taking the code and finding it’s corresponding English letter by traversing the MorseCodeTree, ‘.’ branches to the left and ‘-‘ branches to the right. The code ‘.--.’ would branch to the left, then to the right, then to the right, then to the left to Fetch the letter ‘p’. Each letter is delimited by a space (‘ ‘). Each word is delimited by a ‘/’.

Some suggestions:
1. There is a morse code translator at:
http://morsecode.scphillips.com/jtranslator.html

This will help you build files and test cases for your JUnit Tests.





Test Cases:
Hello World


How do I love thee let me count the ways







Deliverables / Submissions:
Design: UML class diagram with algorithm (pseudo-code) for methods
Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include:
• UML diagram
• In three or more paragraphs, highlights of your learning experience

Deliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats:
• LastNameFirstName_Assignment5_Complete.zip, a compressed file in the zip format, with the following:
• Write up (Word document) - reflection paragraphs
• UML Diagram – final design (Word or image document or scanned sheet)
• doc.zip (directory) - Javadoc
• File1.html (example)
• File2.html (example)
• Other supporting directories
• src (directory)
• File1.java (example)
• File2.java (example)
• Screen shot of java files in GitHub repository

• LastNameFirstName_Assignment5_Moss.zip, a compressed file containing one or more Java files:
• File1.java (example)
• File2.java (example)
This folder should contain Java source files only.

Note: ONLY SUBMIT THE FILES THAT YOU IMPLEMENTED OR UPDATED FOR THIS ASSIGNMENT. YOU DO NOT NEED TO SUBMIT THE FILES THAT ARE ALREADY PROVIDED FOR YOU.


More products