Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(JAVA ONLY) This practice exercise involves writing a program to translate English into Morse code using a binary search tree. Your program should prompt the

(JAVA ONLY)

This practice exercise involves writing a program to translate English into Morse code using a binary search tree. Your program should prompt the user to specify an English sentence and then display the translated results by searching a binary search tree for each letter and determining the correct sequence of dots and dashes.

3 classes are needed, the Binary search tree and the Morse Class as well as application class

BST must contain both values

image text in transcribed

  • Create a binary search tree using an insert ( ) function to fill the tree with each letter/Morse structure. You should arrange the tree so that it is alphabetically ordered from left to right. Your tree should be balanced - you will have to rearrange the Morse table to make sure that your lookup tree is balanced.
  • Display the binary search tree using pre-order, in-order, and post-order traversals.
  • Display the height of the binary search tree.
  • Prompt the user for an input sentences and display the Morse code result of each.

You may find the following declarations useful in building the binary search tree:

 String[] english = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ",", ".", "?" }; String[] morse = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".---.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----.", "-----", "--..--", ".-.-.-", "..--.." };
code Character ->>>> 3x U Digits code Character code Character ->>>> 3x U Digits code Character

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Debate topic: Is Boeing 737 Max the " New Pinto" agianst argument

Answered: 1 week ago

Question

Please make it fast 5 8 1 .

Answered: 1 week ago