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.
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 <tab> student name <tab> 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.
Step by step
Solved in 3 steps with 1 images