Question: This problem concerns the set of interface and classes found in this file: IFruit Tree.java Note that you may not change any supplied fields or


This problem concerns the set of interface and classes found in this file: IFruit Tree.java Note that you may not change any supplied fields or constructors. This problem has parts a and b: a) [15pts] Design a method for IFruitTree that counts the number of Forks of this IfruitTree b) [20pts] Design a method for IFruit Tree that determines whether every Branch Fork and Fruit of this IfruitTree has the same fruitType. Paste your solutions to parts a and b in the space below. interface IFruitTree { class Branch implements IFruitTree { String fruitType; IFruitTree next; = Branch (String fruitType, IFruitTree next) { this.fruitType fruitType; this.next = next; -} class Fork implements IFruitTree { String fruitType; IFruitTree left IFruitTree right; Fork (String fruitType, IFruitTree left, IFruitTree right) { this.fruitType = fruitType; this.left = left; this.right = right; -} class Fruit implements IFruitTree { String fruitType; Fruit(String fruitType) { this.fruitType = fruitType; This problem concerns the set of interface and classes found in this file: IFruit Tree.java Note that you may not change any supplied fields or constructors. This problem has parts a and b: a) [15pts] Design a method for IFruitTree that counts the number of Forks of this IfruitTree b) [20pts] Design a method for IFruit Tree that determines whether every Branch Fork and Fruit of this IfruitTree has the same fruitType. Paste your solutions to parts a and b in the space below. interface IFruitTree { class Branch implements IFruitTree { String fruitType; IFruitTree next; = Branch (String fruitType, IFruitTree next) { this.fruitType fruitType; this.next = next; -} class Fork implements IFruitTree { String fruitType; IFruitTree left IFruitTree right; Fork (String fruitType, IFruitTree left, IFruitTree right) { this.fruitType = fruitType; this.left = left; this.right = right; -} class Fruit implements IFruitTree { String fruitType; Fruit(String fruitType) { this.fruitType = fruitType
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
