logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

Piper SharpMathematics

643 Answers

Hire Me
Dorian FieldsResume writing

688 Answers

Hire Me
Noormehal MohamaadFinance

647 Answers

Hire Me
Jax MahoneySocial sciences

901 Answers

Hire Me
C++ Programming

you will push your C++ skills to the limit by implementing a simple database system using binary search trees


CPSC 350: Data Structures Assignment 5, Version 1.2

Building a Database with Binary Search Trees  


In this assignment, you will push your C++ skills to the limit by implementing a simple database system using binary search trees. Though the end product will be a far cry from Oracle or MySQL, your DB will allow the user to insert, delete, and query data. The data itself will be persistent (stored on disk), so that you may process it over several sessions.

The DB itself will contain data that would be commonly found in a university’s computer system. In our case, this information consists of student and faculty records. The information for each will be stored in its own tree (or “table” in DB terminology).

Though I will provide you with a general outline of the program, many of the implementation details will be up to you. In the same spirit, I will give you a point in the right direction as far as some of the C++ techniques go, but it will also be your responsibility to research the techniques in more detail.

Details Tables

The tables that store the records in your DB will be binary search trees. The nodes will consist of Student or Faculty objects, depending on the tree. The tree will be sorted on the primary key value of the nodes, which in our case will be faculty and student Ids.

Your first job will be to build a BST implementation supporting the usual operations (including delete). This should not be difficult in and of itself. Just be sure to use templates to make your implementation generic, and overload operators as required.

Student Records

Student records will be stored in a Student class. Student records contain a unique student ID (an integer), a String name field, a string level field (Freshman, Sophomore, etc), a String major field, a double GPA field, and an integer advisor field, which will contain the Faculty ID of their advisor. These are the only fields the class contains.

The Student class must overload equality, less than, greater than operators, etc. so that we can compare them to one another.

Faculty Records

Faculty records are similar to student records, and will also require overloaded operators.

Faculty records contain an integer Faculty ID, a String name, a String level (lecturer, assistant prof, associate prof, etc), a String department, and a list of integers corresponding to all of the faculty member’s advisees’ ids. These are the only fields the class contains.

How the Program Should Work


Your program will keep references to both the faculty and student tables in memory. These references are simply BSTree instances. For convenience, we will call them masterFaculty and masterStudent.

When the program starts, it should check the current directory for the existence of 2 files “facultyTable” and “studentTable”. These files correspond to the BSTrees containing the faculty and student data. If neither of these files exist, then masterFaculty and masterStudent should be initialized as new, empty trees. If the files do exist, then they should be read into the appropriate variables. (See appendix A)


Once the tables have been set up, a menu should be presented to the user to allow them to manipulate the databases. At a minimum (if you do more you’ll get more credit), the choices should include:

  1. Print all students and their information (sorted by ascending id #)

  2. Print all faculty and their information (sorted by ascending id #)

  3. Find and display student information given the students id

  4. Find and display faculty information given the faculty id

  5. Given a student’s id, print the name and info of their faculty advisor

  6. Given a faculty id, print ALL the names and info of his/her

  7. Add a new student

  8. Delete a student given the id

  9. Add a new faculty member

  10. Delete a faculty member given the

  11. Change a student’s advisor given the student id and the new faculty

  12. Remove an advisee from a faculty member given the ids

  13. Rollback

  14. Exit


When a command is selected, you should prompt the user for the required data, and execute the command. If there are any errors, you should inform the user and abort the command.


All of the above commands should enforce referential integrity. That is to say, a student can not have an advisor that is not in the faculty table. A faculty member can’t have an advisee in the student table. If a faculty member is deleted, then their advisees must have their advisors changed, etc. Your commands will be responsible for maintaining referential integrity. If a user issues a command that would break referential integrity, you should warn them and abort the command, or execute the command and fix any violations as appropriate.



After each command is executed, the menu should be displayed again, and the user allowed to continue.


The Rollback command is used if the user realizes they have made a mistake in their data processing. The Rollback command will “undo” the previous action, but only if that action changed the structure of the DB. Your program should allow the user to roll back the last 5 commands that CHANGED the DB. (Commands that simply display data do not count.) This will involve keeping snapshots of the DB before and after commands are issued. The implementation details for this are left up to you.

If the user chooses to exit, you should write the faculty and student tables back out to the “facultyTable” and “studentTable” files (see appendix A), clean up, and quit gracefully.

Programming Strategy

At this point you should realize this is a non-trivial assignment. To successfully complete it, you need to make use of your best OO design and programming skills. Think modularly, sketch out a solution before you start coding, and START EARLY. Sleeping is optional, but not recommended.


-You may work in groups of 2 on this assignment. (HIGHLY Recommended)

-All code must be your own

-Develop on any platform you wish, but make sure it compiles/runs with g++ within your Linux Docker container

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

283 Experts Online