write a C++ program for implementing a simple binary search tree capable of storing and retrieving...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 <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. 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 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 <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. 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
Expert Answer:
Answer rating: 100% (QA)
include using namespace std node class class Node public data members int id string s... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
6. Justin wants to purchase a $250,000 5-year term life insurance policy. He is 24 years old. What is his annual premium? 7. Eight years ago, Michael purchased a $150,000, 20-year payment life...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
A PLC is used to count the number of cans traveling by on a conveyor belt in a fish canning factory. An optical proximity switch detects the passage of each can, sending a discrete (on/off) signal to...
-
Jordan, Corp. completed the following transactions in 2015: Jan 1 Purchased a building costing $100,000 and signed a 10-year, 10% mortgage note payable for the same amount. Jun 30 Made the first...
-
Define the following terms: joint production process, joint costs, joint products, split-off point, separable costs, and by-product.
-
What is a Phase of Operation?
-
Santiago Manufacturing Company began operations on January 1. During the year, it started and completed 2,000 units of product. The company incurred the following costs. 1. Raw materials purchased...
-
The Merlin rocket engines developed by SpaceX can produce 7.41 x 105 N of instantaneous thrust with an exhaust speed of 3.05 x 103 m/s in vacuum. What mass of fuel does the engine burn each second to...
-
On December 1, a six-month liability insurance policy was purchased for $900. Analyze the required adjustment as of December 31 using T accounts, and then formally enter this adjustment in the...
-
Q2. Communication is a way of conveying the intended information and ideas to others with the help of different modes. What are different modes of communication and which one is considered most...
-
It is common practice for programmers to create continuous test - and - loop code in order to poll I/O devices or wait for interrupts to occur. Some processors provide an instruction ( WAIT or HALT )...
-
What special problems do super pipelined and superscalar architectures pose for real - time system designers? Are they any different for nonreal - time systems?
-
What are some of the tasks suggested in technical support?
-
What are control flow knots, and why should they be avoided?
-
In CISC - type processors, most instructions are having memory operands, while RISC - type processors access memory by LOAD and STORE instructions only. What are the advantages and disadvantages of...
-
Let Y : [0, )R, Y : [0, ) R, f: [0, ) R and g : [0, ) R be functions such that f(0) = g(0) = 0, x and g(x) = te-dt, x > 0. 0 w(x)=e* + x, x 0, V(x)=x-2x - 2e*+2, x 0, f(x) = (lt-t) e-dt, x>0
-
What are the six activities involved in the physical supply/distribution system?
-
Write an O(n)-time non recursive procedure that, given an n-node binary tree, prints out the key of each node in the tree. Use a stack as an auxiliary data structure.
-
Show that if a DECREMENT operation were included in the k-bit counter example, n operations could cost as much as (nk) time.
-
Approximate n k = 1 k 3 with an integral.
-
Explain the significance of the microscopic and macroscopic approaches to the study of thermodynamics.
-
Why is the thermodynamic process also called cyclic process? Explain with suitable example.
-
Define isothermal, isochoric and isobaric processes with suitable examples.
Study smarter with the SolutionInn App