Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 18, Problem 18.35PE
Program Plan Intro
H-tree fractal
Program Plan:
- Import required packages.
- Declare a main class named “E35” which extends the “Application” class.
- Declare a “start ()” method which overrides the “start ()” method in the “Application” class. Inside this method,
- Create a pane and a text field.
- Set the action listener for the text field.
- Set the value of the property.
- Set the text field at the bottom right.
- Create a label and add the text field object to the pane.
- Create a border pane.
- Create a scene and place it on the stage.
- Set the title as “Exercise18_35”.
- Display the stage on the window using “primaryStage.show()” method.
- Set the width and height property.
- Declare a class named “HPane”.
- Declare a variable.
- Give function definition to set new order.
- Set the order of the tree.
- Call the function “paint ()”.
- Give function definition for “paint ()”.
- Calculate the width and height.
- Calculate the length.
- Clear the pane using “clear ()” method. Call the function “displayHTree ()”.
- Give function definition for “displayHTree ()”.
- Choose four end points.
- Create three lines.
- Check if the value of “treeOrder” is greater than 0.
- Call the function recursively.
- Declare a main method using “public static main”.
- Launch the method using “launch ()” method.
- Declare a “start ()” method which overrides the “start ()” method in the “Application” class. Inside this method,
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Language : C
2). Write a program to implement the following graph representations and display
them.
i. Adjacency list
ii. Adjacency matrix
FAST
Chapter 18 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 18.2 - What is a recursive method? What is an infinite...Ch. 18.2 - Prob. 18.2.2CPCh. 18.2 - Show the output of the following programs and...Ch. 18.2 - Prob. 18.2.4CPCh. 18.2 - Prob. 18.2.5CPCh. 18.2 - Write a recursive mathematical definition for...Ch. 18.3 - Prob. 18.3.1CPCh. 18.3 - What is wrong in the following methods?Ch. 18.3 - Prob. 18.3.3CPCh. 18.4 - Describe the characteristics of recursive methods.
Ch. 18.4 - Prob. 18.4.2CPCh. 18.4 - Prob. 18.4.3CPCh. 18.5 - Prob. 18.5.1CPCh. 18.5 - Prob. 18.5.2CPCh. 18.5 - What is a recursive helper method?Ch. 18.6 - Prob. 18.6.1CPCh. 18.6 - How does the program get all files and directories...Ch. 18.6 - How many times will the getSize method be invoked...Ch. 18.6 - Will the program work if the directory is empty...Ch. 18.6 - Will the program work if line 20 is replaced by...Ch. 18.6 - Will the program work if lines 20 and 21 are...Ch. 18.7 - Prob. 18.7.1CPCh. 18.8 - Prob. 18.8.1CPCh. 18.8 - Prob. 18.8.2CPCh. 18.8 - How many times is the displayTriangles method...Ch. 18.8 - Prob. 18.8.4CPCh. 18.8 - Prob. 18.8.5CPCh. 18.9 - Which of the following statements are true? a. Any...Ch. 18.9 - Prob. 18.9.2CPCh. 18.10 - Identify tail-recursive methods in this chapter.Ch. 18.10 - Rewrite the fib method in Listing 18.2 using tail...Ch. 18 - Prob. 18.1PECh. 18 - Prob. 18.2PECh. 18 - (Compute greatest common divisor using recursion)...Ch. 18 - (Sum series) Write a recursive method to compute...Ch. 18 - (Sum series) Write a recursive method to compute...Ch. 18 - (Sum series) Write a recursive method to compute...Ch. 18 - (Fibonacci series) Modify Listing 18.2,...Ch. 18 - Prob. 18.8PECh. 18 - (Print the characters in a string reversely) Write...Ch. 18 - (Occurrences of a specified character in a string)...Ch. 18 - Prob. 18.11PECh. 18 - (Print the characters in a string reversely)...Ch. 18 - (Find the largest number in an array) Write a...Ch. 18 - (Find the number of uppercase letters in a string)...Ch. 18 - Prob. 18.15PECh. 18 - (Find the number of uppercase letters in an array)...Ch. 18 - (Occurrences of a specified character in an array)...Ch. 18 - (Tower of Hanoi) Modify Listing 18.8,...Ch. 18 - Prob. 18.19PECh. 18 - (Display circles) Write a Java program that...Ch. 18 - (Decimal to binary) Write a recursive method that...Ch. 18 - (Decimal to hex) Write a recursive method that...Ch. 18 - (Binary to decimal) Write a recursive method that...Ch. 18 - (Hex to decimal) Write a recursive method that...Ch. 18 - Prob. 18.25PECh. 18 - (Create a maze) Write a program that will find a...Ch. 18 - (Koch snowflake fractal) The text presented the...Ch. 18 - (Nonrecursive directory size) Rewrite Listing...Ch. 18 - (Number of files in a directory) Write a program...Ch. 18 - (Game: Knights Tour) The Knights Tour is an...Ch. 18 - (Game: Knights Tour animation) Write a program for...Ch. 18 - (Game: Eight Queens) The Eight Queens problem is...Ch. 18 - Prob. 18.35PECh. 18 - (Sierpinski triangle) Write a program that lets...Ch. 18 - (Hilbert curve) The Hilbert curve, first described...Ch. 18 - (Recursive tree) Write a program to display a...Ch. 18 - Prob. 18.39PE
Knowledge Booster
Similar questions
- 22.........a) Write a program that asks the user to enter the number of vertices in a directed graph and then the adjacency matrix representing the directed graph. The program, then, must display the node with the highest outdegree. Assume that nodes are named as 0, 1, 2, and so on.asaparrow_forward2. (Begun in class) Write a YES instance of 3-SAT. Then draw the Vertex Cover instance that comes from your YES instance. What is K (#variables +2*#clauses). Mark the vertices that form the Vertex Cover. b. Write a NO instance of 3-Sat, and again, draw the graph from this. Mark the vertices that come as close as possible to being a Vertex Cover.arrow_forward***Please type your answer or write in print, because I have had great difficulty with understanding most handwritten assistance done in cursive or mixed print/cursive.arrow_forward
- 3. Refer to the graph G below. w i h e G Map out all of the following graphs: a) walk b) path c) circuit d) сycle e) trianglearrow_forward2. Q1) You are given an undirected connected planar graph. There are 10 vertices and 7 faces in the graph. What is the number of edges in the graph? Note that: A graph is said to be planar if it can be drawn in a plane so that no edge cross. Q2) In how many ways can we pick any number of balls from a pack of three different balls? Q3) The distance between 2 points A and B is 1320Km. Two cars start moving towards each other with 50 Km/hr and 60 Km/hr. After how many hours do they meet?arrow_forwardc) An expression of A + B^3 – C/D is obtained using a rooted tree. i. Draw a rooted tree with the height of 2 to represent the postorder traversal. ii. Justify whether the rooted tree in 3-c(i) is balanced or not. iii. From tree in c(i), get the mathematical expression using the inorder traversal. d) Figure 3 represents a network of paths in a park. The number on each edge represents the length of the path in meters. The cost per meter is RM120. To gain as much profit, the contractor asked one of his staff to find the minimum network needed using Kruskal's algorithm. G 21 16 17 21 F 11 23 E 11 7 15 18 В 11 20 A Figure 3 i. Explain why the staff's work which is highlighted in red is incorrect. ii. Help the staff to find the correct minimum network using Kruskal's algorithm and states its length and total cost. iii. Is there any possibiliy, more than one distint MST obtained for the Figure 3?. If yes, justify your answer and show the network.arrow_forward
- ] ] hav_hak Write a function "hav_hak(Ist)" that takes in a list of non-increasing integers as its input, and then determines whether or not this is the degree sequence of a graph. After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (hav_hak( [3,3,3,3,3]), hav_hak( [3,3,2,2,2,2])) This should return False True + Code + Markdown Python Pythonarrow_forwardAI a modern approach 10.3 The monkey-and-bananas problem is faced by a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. Initially, the monkey is at A, the bananas at B, and the box at C. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. The actions available to the monkey include Go from one place to another, Push an object from one place to another, ClimbUp onto or ClimbDown from an object, and Grasp or Ungrasp an object. The result of a Grasp is that the monkey holds the object if the monkey and object are in the same place at the same height. a. Write down the initial state description.b. Write the six action schemas.c. Suppose the monkey wants to fool the scientists, who are off to tea, by grabbing the bananas, but leaving the box in its original place. Write this as a general goal (i.e.,…arrow_forward6. Given the algebraic expression below: a) b) Draw the Expression tree. --++(²+1) (e+f *0* b-c Get the infix, prefix and postfix expression.arrow_forward
- All codes should be in c++ or carrow_forward] ] is_bipartite In the cell below, you are to write a function "is_bipartite (graph)" that takes in a graph as its input, and then determines whether or not the graph is bipartite. In other words, it returns True if it is, and False if it is not. After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (is_bipartite({"A" : ["B", "C"], "B" : ["A"], "C" : ["A"]}), is_bipartite({"A" : ["B", "C"], "B" : ["A", "C"], "C" : ["A", "B"]})) This should return True False Python Pythonarrow_forwardwrite this code using c++ or python plzarrow_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