CS 631 - Computing Fundamentals II - Spring 2005
Programming Assignment 4


Loyola College > Department of Computer Science > CS 631 > Programming Assignments > Programming Assignment 4

Creating a Decision Tree

Due

Tuesday, April 25th at the beginning of class. Email an electronic copy by attaching each .cpp and .h to the email. Also, email the file created by the program which should contain at least 8 questions (internal nodes). In addition, turn in a printout of the code and the decision tree. Be sure to include the Honor Code Statement: "I hereby declare that I have abided by the Honor Code during this assignment."

Introduction

One branch of Artificial Intelligence uses what are known as decision trees to solve problems. A decision tree represents knowledge by storing questions at internal nodes of the tree and answers at the leaves. When using the decision tree to solve a problem, one follows a path in the tree based on the answers to questions until an answer is reached.

For this assignment you will create a decision tree that contains knowledge about a subject of your choice. A concrete example is given in the text.

Assignment

  1. Complete Programming Problem 4 on page 587.
  2. Your program should first call a function announce to describe the purpose of your program.
  3. Prompt a user for a file name where the file contains the current version of the decision tree. If this file is empty or does not exist, it should prompt the user for the initial question and the yes and no answers.
  4. After the initial node of the tree is created, the program can behave as described in Problem 4.
  5. At the completion of the program, save the new knowledge that is aquired to original file. This should be done automatically without prompting the user. In this way the size of the knowledge base can grow with each execution of the program.
  6. Design your program using a modular approach, and should include classes and structs if you wish. You are not allowed to use global variables, although you may define global constants.
  7. You may make use of the ADT BinaryTree in the text: TreeException.h, TreeNode.h, BinaryTree.h, and BinaryTree.cpp. (Sample tester: TreeTest.cpp)

Grading