can you help me to draw the flow chart for the java code: import java.util.Scanner; class BinoNode { int data; int numNodes; BinoNode arr[]; public BinoNode(int k) { data = -1; numNodes = k; arr = new BinoNode[numNodes]; } } class BinomialTree { private BinoNode root; private int order, size; public BinomialTree(int k) { size = 0; order = k; root = new BinoNode(order); createTree(root); } private void createTree(BinoNode r) { int n = r.numNodes; if (n == 0) { return; } for (int i = 0; i < n; i++) { r.arr[i] = new BinoNode(i); createTree(r.arr[i]); } } public void clear() { size = 0; root = new BinoNode(order); createTree(root); } public void insert(int val) { try { insert(root, val); } catch (Exception e) { } } private void insert(BinoNode r, int val) throws Exception { if (r.data == -1) { r.data = val; size++; throw new Exception("inserted !"); } int n = r.numNodes; for (int i = 0; i < n; i++) { insert(r.arr[i], val); } } public void printTree() { System.out.print("\nBinomial Tree = "); printTree(root); System.out.println(); } private void printTree(BinoNode r) { if (r.data != -1) { System.out.print(r.data + " "); } int n = r.numNodes; if (n == 0) { return; } for (int i = 0; i < n; i++) { printTree(r.arr[i]); } } } public class BinomialTreeProject { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("##----Binomial Tree----##"); System.out.println("\nEnter order of binomial tree:"); System.out.print("= "); BinomialTree binomialTree = new BinomialTree(scan.nextInt()); boolean quit = false; do { System.out.println("\n#---Binomial Tree Operations---#"); System.out.println("1. Insert "); System.out.println("2. Delete"); System.out.println("3. Search"); System.out.println("4. Print"); System.out.println("5. Quit"); System.out.print("Enter your option = "); int choice = scan.nextInt(); switch (choice) { case 1: System.out.println("Enter integer element to insert"); System.out.print("= "); binomialTree.insert(scan.nextInt()); break; case 2: binomialTree.clear(); System.out.println("\nTree Cleared\n"); break; case 3: System.out.println("TODO: Search"); break; case 4: System.out.print("\n-------------------->"); binomialTree.printTree(); System.out.println("-------------------->"); break; case 5: quit = true; System.out.println("\nThanks for using --Binomial Tree--\n"); break; default: System.out.println("Wrong Entry \n "); break; } } while (quit == false); } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

can you help me to draw the flow chart for the java code:

import java.util.Scanner;
class BinoNode {
int data;
int numNodes;
BinoNode arr[];
public BinoNode(int k) {
data = -1;
numNodes = k;
arr = new BinoNode[numNodes];
}
}
class BinomialTree {
private BinoNode root;

private int order, size;
public BinomialTree(int k) {
size = 0;
order = k;
root = new BinoNode(order);
createTree(root);
}
private void createTree(BinoNode r) {
int n = r.numNodes;
if (n == 0) {
return;
}
for (int i = 0; i &lt; n; i++) {
r.arr[i] = new BinoNode(i);
createTree(r.arr[i]);
}
}
public void clear() {
size = 0;
root = new BinoNode(order);
createTree(root);
}
public void insert(int val) {
try {
insert(root, val);
} catch (Exception e) {
}
}
private void insert(BinoNode r, int val) throws Exception {
if (r.data == -1) {
r.data = val;
size++;
throw new Exception(&quot;inserted !&quot;);
}
int n = r.numNodes;
for (int i = 0; i &lt; n; i++) {
insert(r.arr[i], val);
}
}
public void printTree() {
System.out.print(&quot;\nBinomial Tree = &quot;);
printTree(root);
System.out.println();
}
private void printTree(BinoNode r) {
if (r.data != -1) {
System.out.print(r.data + &quot; &quot;);

}
int n = r.numNodes;
if (n == 0) {
return;
}
for (int i = 0; i &lt; n; i++) {
printTree(r.arr[i]);
}
}
}
public class BinomialTreeProject {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println(&quot;##----Binomial Tree----##&quot;);
System.out.println(&quot;\nEnter order of binomial tree:&quot;);
System.out.print(&quot;= &quot;);
BinomialTree binomialTree = new BinomialTree(scan.nextInt());
boolean quit = false;
do {
System.out.println(&quot;\n#---Binomial Tree Operations---#&quot;);
System.out.println(&quot;1. Insert &quot;);
System.out.println(&quot;2. Delete&quot;);
System.out.println(&quot;3. Search&quot;);
System.out.println(&quot;4. Print&quot;);
System.out.println(&quot;5. Quit&quot;);
System.out.print(&quot;Enter your option = &quot;);
int choice = scan.nextInt();
switch (choice) {
case 1:
System.out.println(&quot;Enter integer element to insert&quot;);
System.out.print(&quot;= &quot;);
binomialTree.insert(scan.nextInt());
break;
case 2:
binomialTree.clear();
System.out.println(&quot;\nTree Cleared\n&quot;);
break;
case 3:
System.out.println(&quot;TODO: Search&quot;);
break;
case 4:
System.out.print(&quot;\n--------------------&gt;&quot;);
binomialTree.printTree();
System.out.println(&quot;--------------------&gt;&quot;);
break;
case 5:
quit = true;
System.out.println(&quot;\nThanks for using --Binomial
Tree--\n&quot;);
break;
default:

System.out.println(&quot;Wrong Entry \n &quot;);
break;
}
} while (quit == false);
}
}

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY