Building a tree for conversion purposes

Assignment Help Data Structure & Algorithms
Reference no: EM131028728

Assignment

Creating a Tree Class, Building a Tree

Converting Morse code to English characters

Concepts tested by this program:
Generic Classes
Utility Class (all static methods)
New concepts tested by this program
Linked Trees
Building a Tree for conversion purposes

Samuel F. B. Morse produced the first working telegraph set in 1836. This made transmission possible over any distance. The first Morse Code message, "What hath God wrought?", was sent from Washington to Baltimore.

Morse code was extensively used for early radio communication beginning in the 1890s.

In the early part of the twentieth century, the majority of high-speed international communication was conducted in Morse code, using telegraph lines, undersea cables, and radio circuits.

Morse code can also be transmitted using light which sometimes happens between ships at sea. It is used in emergencies to transmit distress signals when no other form of communication is available. The standard international distress signal is •••---••• (SOS).

Your assignment is to write a generic TreeNode class, a MorseCodeTree class and a MorseCodeConverter class. There is no GUI required for this assignment. Your classes will be tested with Junit tests.

TreeNode class

This generic class is used in the MorseCodeTree classes. The class consists of a reference to the data and a reference to the left and right child. Follow the Javadoc that is provided. The Javadoc only lists those public methods that are required to pass the Junit tests. You may add any private methods you need for your design.

MorseCodeTree class

A generic linked binary tree which inherits from the LinkedConverterTreeInterface. The class uses an external generic TreeNode class parameterized as a String: TreeNode<String>. This class uses the private member of root. Nodes are added based on their morse code value. A ‘.' (dot) means to traverse left and a ‘-‘ (dash) means to traverse right. The constructor will "build the tree". Follow the Javadoc that is provided. The Javadoc only lists those public methods that are required to pass the Junit tests. You may add any private methods you need for your design.

Building the Data Structure (buildTree)

Your MorseCodeTree is a tree 4 levels. 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 Data Structure

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 ‘/'.

MorseCodeConverter - Utility Class

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.

The JUnit Test Class

You must add at least 1 test for MorseCodeConverter.convertToEnglish(String) and at least 1 test for MorseCodeConverter.convertToEnglish(File) to the MorseCodeConverterTest class. Include your test file with your code files.

Test Cases:

Hello World

How do I love thee let me count the ways

Reference no: EM131028728

Questions Cloud

Explain why this is a matched-pairs experiment : Explain why this is a matched-pairs experiment and give reasons why the pairing should be useful in increasing information on the difference between the mean reaction times to prohibitive and permissive traffic signs.
Current month financial statements : At the end of the current month, Gil Frank prepared a trial balance for College App Services. The credit side of the trial balance exceeds the debit side by a significant amount.
Working with partner to plan and host workshop on leadership : Imagine you are working with a partner to plan and host a workshop on leadership. There will be 100 people attending. Describe what strengths you would like your partner to have for this particular task, and why? Explain how the strengths you have ch..
Cash receipts and disbursements for the month : The auditors of Steffey Ltd., decided to study the cash receipts and disbursements for the month of July of the current year under audit. They obtained the bank reconciliations and the cash journals prepared by the company accountants, which revea..
Building a tree for conversion purposes : Creating a Tree Class, Building a Tree. Converting Morse code to English characters. Concepts tested by this program: Generic Classes, Utility Class, New concepts tested by this program, Linked Trees, Building a Tree for conversion purposes.
Unethical to market these products to these consumers : Describe two products that you think appeal to compulsive consumers. Articulate whether you think it is ethical or unethical to market these products to these consumers. (expand in depth)
Find observed significance level for test and interpret : Do the data provide sufficient evidence to indicate that, on the average, the customer tends to underestimate the CPU time required for computing jobs? Test using α=.10.
Undergo testing before the physician determines diagnosis : Mr. Stevens comes to your office complaining that he is frequently losing his balance. He says that he feels like a drunken man when he walks and cannot even draw a straight line. Mr. Stevens will have to undergo testing before the physician determin..
Do the same for a circle that has its center at the point : Do the same for a circle that has its center at the point (h, k) and passes through the point (x_0, y_0), where h, k, x_0, y_0 are real numbers such that the conditions h = x_0 and k = y_0 are not both satisfied.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Methods of generated data experiments

Overview of the different methods of generated data experiments - Some of visualization techniques are provided in this research to show how well the predictive modelling is performing and show an interesting method in the data related to the proje..

  Versatile cryptographic algorithm

Stallings states, "...perhaps the most versatile cryptographic algorithm is the cryptographic hash function." Give your opinion as to whether or not you agree or disagree with him. Provide a rationale for your response

  Explain feasibility analysis for jobs of lrt algorithm

Study feasibility analysis for jobs of LRT algorithm when preemption is allowed. Which scheduling algorithm is best suited for high speed networks and why? Distinguish between static and dynamic systems.

  What are the equivalence classes of this relation

Show that the reachability matrix R for an undirected graph with n vertices can be constructed in 0 ( n 2 )time.

  Principles and theory of security management

think of some intrusions - the disgruntled mailman flying onto the Capitol lawn on his gyrocopter and remember the couple who crashed a White House function a few years ago?

  In addition make a flow-chart to show how to sort using one

there are many additional algorithms available. choose 2 sorting and 2 searching algorithms and describe them in

  How many paths are there to the goal

Show your pseudo code for this algorithm. Is this an admissible heuristic function and How many possible states are there? How many paths are there to the goal?

  Write a function to insert a node after the head

In a doubly-lined list, each node points to both the next and previous nodes. The info in the each node is an integer and two pointers, one to the previous node and one to the next node - Define the node

  Concept learninga write an algorithm called find-g to nd a

concept learninga write an algorithm called find-g to nd a maximally-general consistent hypothesis. you can assume the

  Create a web page named bin.html that performs binary search

The sort method, when applied to an array of strings, returns a copy of that array in which the strings appear in alphabetical order. For example, if the variable words stored the array ["foo", "bar", "biz"], then the call words .sort() would retu..

  Determine algorithm for cs curriculum consists of n courses

Determine an algorithm which works directly with this graph representation, and calculates minimum number of semesters necessary to complete the curriculum.

  What numbers are compared to 72 if a sequential search is

question 1. what numbers are compared to 72 if a sequential search is used 2 5 7 9 11 17 18 21 28 30 45 5465 69 72.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd