Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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. 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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91753245
  • Price:- $55

Priced at Now at $55, Verified Solution

Have any Question?


Related Questions in Computer Engineering

What is the role of arp and how does it cause a security

What is the role of ARP and how does it cause a security concern? What is the different between global and private IP addresses? How does using NAT change a private IP address into a global IP address, and why is this so ...

Question suppose you want to perform two sums one is a sum

Question : Suppose you want to perform two sums: one is a sum of 10 scalar variables, and one is a matrix sum of a pair of two-dimensional arrays, with dimensions 10 by 10. What speed-up do you get with 10 versus 100 pro ...

A random sample ofnbsp87nbspeighth gradenbspstudents scores

A random sample of 87 eighth grade? students' scores on a national mathematics assessment test has a mean score of 279. This test result prompts a state school administrator to declare that the mean score for the? state' ...

A sample of a compound is decomposed in the laboratory and

A sample of a compound is decomposed in the laboratory and produces 330 g carbon, 69.5 g hydrogen, and 220.2 g oxygen. Calculate the empirical formula of the compound. Express your answer as an empirical formula.

String cyclic leftshift string s int k that creates and

String cyclic LeftShift (String s, int k) that creates and returns a string in which character of s has been moved left k steps, so that the characters that would "fall off' the left end are appended to the right. For ex ...

Question suppose a class car is a child of a class vehicle

Question : Suppose a class Car is a child of a class Vehicle. Suppose Vehicle and Car have methods Move(). Method Move() of the class Car calls method Move() of the class Vehicle(). Write the statement in Move() of the c ...

Assignmentsuppose a particular fa called fin has the

Assignment Suppose a particular FA, called FIN, has the property that it had only one final state that was not the start state. During the night, vandals come and switch the + sign with the - sign and reverse the directi ...

What are the similarities and differences of hierachical

What are the similarities and differences of hierachical, Network, and Object Oriented Database Models.

30 of the cars in a dealer lot are red 21 are black and 22

30% of the cars in a dealer lot are red, 21% are black, and 22% are white. The remainder are some other unspecified color. Salespersons randomly shows three cars to three different customers. What is the probability the ...

The sales figures for a business are as follows for the

The sales figures for a business are as follows for the first six months of the year: R40 000, R44 000, R52 000, R64 000, R80 000, R84 000. The owner believes that the sales curve can be approximated by a quadratic funct ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As