BUILDING JAVA PROGRAMS-TEXT
5th Edition
ISBN: 2810023481209
Author: REGES
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 17, Problem 2PP
Program Plan Intro
Encode and decode of Morse code files
Program plan:
- Create an class“MorseTree”,
- Construct the object for “BinaryTreeNode”.
- Declare the size variable
- Specify the necessary constants
- Define the constructor to creates a new instance of “MorseTree”,
- Create the object to set up the tree
- Initialize the dictionary by filling it with object pairs with numbers.
- Initialize the dictionary by filling it with object pairs with alphabets.
- Initialize the dictionary by filling it with object pairs with numbers.
- Define the method “putn()”,
- Assign the initial values.
- Assign the value get from “getRoot()” to the object.
- Construct the object for “BinaryTreeNode”.
- Execute loop till down to the path,
- Assign the substring.
- Check whether the values are equal,
- Check whether there is a left child,
- Get and assign the left child.
- Otherwise, Set the left child.
- Increment the size.
- Assign the left child to the binary tree.
- Get and assign the left child.
- Call the method “set_Parent()”.
- Check whether there is a left child,
- Otherwise,
- Check there is a right child,
- Get and assign the right child.
- Otherwise,
- Set the right child.
- Increment the size.
- Assign the right child to the binary tree.
- Get the right child.
- Set the parent to the right child.
- Check there is a right child,
- Set the element.
- Define the method “decode()”,
- Assign the necessary values to the variable
- Get the root of the tree
- Execute till the length,
- Get and assign the substring.
- Check whether the values are equal,
- Check there is a left child,
- Get the left child.
- Otherwise,
- Throws an exception "RuntimeException”.
- Otherwise, check whether the values are equal,
- Check there is a right child,
- Get the right child.
- Otherwise,
- Throws an exception "RuntimeException".
- Check there is a right child,
- Check there is a left child,
- Return the elements.
- Define the method “getRoot()” to return the root.
- Define the method “size()” to return the size.
- Define the method “main()” ,
- Print the heading.
- Create the object for MorseTree.
- Assign the decode fragment.
- Print the values.
- Print the decoded output for those values.
- Create a class “BinaryTreeNode”,
- Declare the object variables.
- Define the constructor to create an empty binary tree.
- Define the parameterized constructor to set the elements into the binary tree.
- Define the method “set_Parent()” to set the parent node.
- Define the method “getParent()” to return the parent node.
- Define the method “set_LeftChild()” to set the left child.
- Define the method “set_RightChild()” to set the right child.
- Define the method “has_LeftChild()” to check there is a left child.
- Define the method “has_RightChild()” to check there is a right child.
- Define the method “set_Element()” to set the element into the tree.
- Define the method “get_LeftChild()” to return the left child.
- Define the method “get_RightChild()” to return the right child.
- Define the method “element()” to return the element.
- Define the method “get_Height()” to find the height of the tree.
- Define the method “find_Height()” ,
- Check whether the node is a leaf,
- Return “0”.
- Otherwise, return the computed value.
- Check whether the node is a leaf,
- Define the method “isLeaf()”,
- Return the Boolean value.
- Define the method “getSize()” to return the size.
- Define the method “findSize()” to find the size.
Expert Solution & Answer

Want to see the full answer?
Check out a sample textbook solution
Students have asked these similar questions
Task 1: Write an abstract class Method
+: public
-: private
#: protected
Underline: static
# input: int
# output:String
Method
+ isHard():boolean
+ specificWay():String
+ Method()
+ Method(input: int, output: String)
+ getInput(): int
+ setInput(input: int): void
+ getOutput(): String
+ setOutput(output: String): void
+toString(): String
Question
Task 2: Write a class ReadMethod that extends the Method class.
+: public
-: private
#: protected
Underline: static
-language: String
ReadMethod
Question
+ ReadMethod()
+ ReadMethod(input: int, output: String, language: String)
+ isHard():boolean
+ specific Way(): String
+toString(): String
+ getLanguage(): String
+ setLanguage(language: String): void
i have attatched my java question , please make sure it is answered correct, include all comments etc, thank you
i have attached my 2 java questions . please answer them correctly, add all comments etc . thank you.
Chapter 17 Solutions
BUILDING JAVA PROGRAMS-TEXT
Ch. 17.1 - Prob. 1SCPCh. 17.1 - Prob. 2SCPCh. 17.1 - Prob. 3SCPCh. 17.2 - Prob. 4SCPCh. 17.2 - Prob. 5SCPCh. 17.2 - Prob. 6SCPCh. 17.2 - Prob. 7SCPCh. 17.2 - Prob. 8SCPCh. 17.2 - Prob. 9SCPCh. 17.3 - Prob. 10SCP
Ch. 17.3 - Prob. 11SCPCh. 17.3 - Prob. 12SCPCh. 17.3 - Prob. 13SCPCh. 17.4 - Prob. 14SCPCh. 17.4 - Prob. 15SCPCh. 17.4 - Prob. 16SCPCh. 17.4 - Prob. 17SCPCh. 17.4 - Prob. 18SCPCh. 17.4 - Prob. 19SCPCh. 17.4 - Prob. 20SCPCh. 17.4 - Prob. 21SCPCh. 17.4 - Prob. 22SCPCh. 17.4 - Prob. 23SCPCh. 17.4 - Prob. 24SCPCh. 17.4 - Prob. 25SCPCh. 17.5 - Prob. 26SCPCh. 17.5 - Prob. 27SCPCh. 17 - Prob. 1ECh. 17 - Prob. 2ECh. 17 - Prob. 3ECh. 17 - Prob. 4ECh. 17 - Prob. 5ECh. 17 - Prob. 6ECh. 17 - Prob. 7ECh. 17 - Prob. 8ECh. 17 - Prob. 9ECh. 17 - Prob. 10ECh. 17 - Prob. 11ECh. 17 - Prob. 12ECh. 17 - Prob. 13ECh. 17 - Prob. 14ECh. 17 - Prob. 15ECh. 17 - Prob. 16ECh. 17 - Prob. 17ECh. 17 - Prob. 18ECh. 17 - Prob. 19ECh. 17 - Prob. 20ECh. 17 - Prob. 21ECh. 17 - Prob. 2PP
Knowledge Booster
Similar questions
- Can you help me solve this problem using Master's Theorem:Solve the recurrence relation f(n) = 3af(n/a) + (n + a)2 with f(1) = 1 and a > 1 byfinding an expression for f(n) in big-Oh notation.arrow_forwardhere is example 7.6## Example 7.6 Suppose the sample population is χ 2 (2), which is non-normal but with same variance 4. ▶ Repeat the simulation, but replacing the N(0, 4) samples with χ 2 (2) samples. ▶ Calculate the empirical confidence level.(Empirical confidence level) n <- 20 alpha <- 0.05 UCL <- replicate(1000, expr = { x <- rchisq(n,df=2) (n-1)*var(x)/qchisq(alpha,df=n-1) }) sum(UCL >4) mean(UCL > 4) ## t.test function n <- 20 x <- rnorm(n,mean=2) result <- t.test(x,mu=1) result$statistic result$parameter result$p.value result$conf.int result$estimatearrow_forwardusing r languagearrow_forward
- using r languagearrow_forwardDescribe a business example where referential integrity avoids data problems. specifying in the description of what the problems are and how they can be avoided. thaksarrow_forwardHow do the concepts of balancing and leveling affect the process of creating a data model of a system? thanksarrow_forward
- what is the relationship between a Context Diagram and Diagram 0 in the DFD process. I need to Use an examplearrow_forwardWord Processing The assignment is a newsletter for your friends and family to let them know what’s going on in your life. Your document cannot contain profanity or obscene material—this is a business assignment. The minimum requirements for your newsletter are listed below. It should contain: 2 – 4 pages Your name A title using WordArt with one or more effects applied Articles with formatted titles using a font and color different than that of the article text A section of at least 2 columns Headers and page numbers on all pages except the first page. A bulleted or numbered list A relevant picture or clip art A formatted table Tabs with leaders going to the tabbed items At least one Sidebar Your name as the document author Boldface, italicized, and underlined text A paragraph with justified margins that is shaded and has a border A paragraph with different line spacing than the rest of the document A left, right, or both indented paragraph NOTE: If providing information from outside…arrow_forwardYou are designing a set of firewall rules for server subnet. You have a Web server that constantly gets high volume of traffic from both internal and public clients, a file server that gets moderate use during regular business hours, a VPN appliance used by sales team when they have occasional travels, and an application server for custom apps served on internal network. Describe the firewall rules you would create and the order in which you would place them. Explain why.arrow_forward
- Please original work In the progression from raw data to actionable knowledge, business analysts play a crucial role in transforming and interpreting data to support strategic decision-making. What do you think are the most important skills a business analyst needs to effectively navigate the transition from data to information and then to knowledge? How can organizations ensure that analysts are equipped to extract meaningful insights that drive informed decisions? Share examples or insights from your own experiences or studies. Please cite in text references and add weblinksarrow_forwardResearch enterprise network services commonly performed by Linux servers. Choose 3 and describe their function, as well as why they are typically set up on Linux machines.arrow_forwardThe term color tone refers to the "temperature" of a photo. Question 17Select one: True Falsearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education