Question: write a C++ program for implementing a simple binary search tree capable of storing and retrieving student information. The class should have private member
write a C++ program for implementing a simple binary search tree capable of storing and retrieving student information. The class should have private member variables (each separated by a tab): student's id number - an integer student's name - a string student's declared major The class should have private member functions as a minimum: openFile - opens the input file testFile - tests the input file has been opened properly readFile - reads in one student's information closeFile - close the input file insert - inserts the students information into the proper place in the tree structure search - search for the student id entered by the user . inorder - traverses the tree structure prompt - prompts the user for a student id number validate - validate the user input value display-display the contents of the binary tree results - student id found or not found result . . The class should have public member functions: class constructor (if needed) driver - order of execution The input file layout: student id number student name student declared major Read the input file students.txt from the current directory until eof storing the student information in ascending order by student id number. When the end of file is reached, traverse the binary tree displaying its contents. The output list should be in ascending order by student id number. Prompt the user for a student id number. Validate this value. If the value is found in the tree structure, let the user know and display the student's information. If the value is not found in the tree structure, let the user know this as well. Continue to prompt for student id numbers until the user wishes to stop. An example: Populating Binary Tree Structure Reading contents.... Student ID Student Name 22222222 Dalton Diggs 33333333 Ben Brothers 55555555 Abby Archer 8888888 Evan Egglish 99999999 Charles Cool End of tree Student Major Organizational Management Graphic Design Mathematics Information Systems Technology Biological Sciences Enter a student id (press Q to quit): -33 Invalid input, try again: twelve Invalid input, try again: 11111111 Student 11111111 not found. students Notepad File Edit Format View Help 55555555 33333333 99999999 22222222 88888888 - Abby Archer Ben Brothers Charles Cool Dalton Diggs Evan Egglish Mathematics Graphic Design Biological Sciences Organizational Management Information Systems Technology
Step by Step Solution
There are 3 Steps involved in it
include using namespace std node class class Node public data members int id string s... View full answer
Get step-by-step solutions from verified subject matter experts
