logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

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

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

CPSC 350: Data Structures Assignment 5, Version 1.2

Building a Database with Binary Search Trees  

Overview

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.

Requirements

-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

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. 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. The LineItem class will represent an individual

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

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

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

expert
Husnain SaeedComputer science

528 Answers

Hire Me
expert
Atharva PatilComputer science

973 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

583 Answers

Hire Me
expert
AyooluwaEducation

972 Answers

Hire Me

Get Free Quote!

290 Experts Online