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. Note: Don't use global variables and use a class and object appropriately.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

Note: Don't use global variables and use a class and object appropriately.

Example execution:
Populating Binary Tree Structure
Reading contents....
Student ID
Student Name
22222222
33333333
55555555
Dalton Diggs
Ben Brothers
Abby Archer
88888888
99999999
End of tree
Evan Egglish
Charles Cool
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:
Invalid input, try again:
twelve
11111111
Student 11111111 not found.
Enter a student id (press Q to quit): 22222222
Student id:
22222222
Student name: Dalton Diggs
Student major: Organizational Management
Enter a student id (press Q to quit): Q
End of program.
Transcribed Image Text:Example execution: Populating Binary Tree Structure Reading contents.... Student ID Student Name 22222222 33333333 55555555 Dalton Diggs Ben Brothers Abby Archer 88888888 99999999 End of tree Evan Egglish Charles Cool 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: Invalid input, try again: twelve 11111111 Student 11111111 not found. Enter a student id (press Q to quit): 22222222 Student id: 22222222 Student name: Dalton Diggs Student major: Organizational Management Enter a student id (press Q to quit): Q End of program.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education