can someone explain how to correct this?

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

can someone explain how to correct this?

Post by answerhappygod »

can someone explain how to correct this?
Can Someone Explain How To Correct This 1
Can Someone Explain How To Correct This 1 (56.58 KiB) Viewed 20 times
public class IntTree { private IntTreeNode overallRoot; public int countEvenBranches () { return evenBranches (overallRoot); } public int evenBranches (IntTreeNode root) { if (root == null) { return 0; } else if (root.data % 2 == 1 || root.left == null && root.right == null) { return evenBranches (root.left) + evenBranches (root.right); } else { return 1 + evenBranches (root.left) + evenBranches (root.right); } } public static void main(String[] args) { System.out.println(new IntTree("[2 [8 [O] null] [1 [7 [4] null) [6 null [9]]]]").evenBranches()); } // Constructs a tree with default numbers public IntTree() { overall Root = null; } // Constructs a tree from the given text representation public IntTree(String s) { overall Root = fromString(s); }

Console IntTree.java:30: error: cannot find symbol System.out.println(new IntTree("[2 [8 [0] null] (1 [7 [4] null] [6 null [9]]]]").evenBranches ()); symbol: method evenBranches Location: class IntTree 1 error
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply