Revise the animal-guessing program from Figure 9.8 so that the initial knowledge tree is obtained by reading

Question:

Revise the animal-guessing program from Figure 9.8 so that the initial knowledge tree is obtained by reading information from a file. Also, when the program ends, the knowledge tree at that point is written to the same file. You must carefully specify the format of the data in this file. The format should make it easy to do two things: (a) read the file and set the initial tree, and (b) write the knowledge tree to the file, using some kind of traversal.

FIGURE 9.8 The Animal-Guessing Program Java Application Program // FILE: Animal.java // This animal-guessing program illustrates the use of the binary tree node class. import edu.colorado.nodes.BTNode; // For BTNode import java.util.Scanner; public class Animal private static Scanner stdin = new Scanner(System.in); public static void main(String[ ] args) { BTNode root;

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: