This program extends the random access file case study from chapter 1 in our textbook. The book states that the “case study is primarily designed to illustrate the use of generic classes and...

This program extends the random access file case study from chapter 1 in our textbook. The book states that the “case study is primarily designed to illustrate the use of generic classes and inheritance.” These are concepts that you should be familiar with in C++ from CS 151. Note: as with all other programs this semester, you must write your own code for this assignment, other than any starter code that I provide. You may not work with other students, and you may not copy blocks of code from the internet. You may, however, look up proper synatax of functions online. Understand the Problem Read pages 35 – 45 in your text book (there are only 2.5 pages of text, the rest is the starter code for this case study) to make sure you understand the problem. As it exists, the code generates a random access file of records for two types of objects: personal objects and student objects (extended from personal objects). A driver class called database handles the user input and output and mediates the file manipulation of records. In order to facilitate random access of records, each record must have a specific size – all records are of a uniform size. Keep that in mind as you study the code. I have given you eight files - .h and .cpp files for each of the three classes, plus two starter data files that I have created (personal.dat and student.dat). The only modification to the code that I have made from what appears in the textbook is the addition of a compiler flag at the top of personal.h to enable the use of the strcpy function in Visual Studio; it may or may not be necessary in CLion. If you use a different compiler (such as Clion xCode on a Mac), the presence of this flag should not affect the functionality of the code, but you can modify that flag if necessary. Try running the code with the input files that I have provided. Note that you will need to modify main in database.cpp to enable the use of the program with student objects instead of personal objects. Just comment out one line and uncomment the other. Make sure you understand the functionality of the program and the mechanisms used by the code to carry out the record operations. Your Task Modify the program from the case study to allow the user to remove records from the data file. Define a function isNull() in classes Personal and Student to determine whether a record is null. Define function writeNullToFile() in the two classes to overwrite a record to be deleted by a null record. A null record can be defined as having a nonnumeric character (a tombstone) in the first position of the SSN member. Then define function remove() in Database (similar to the modify() function), which locates the position of a record to be deleted and overwrites it with the null record. While the current session is running, records that have been marked for deletion should not be displayed to the screen. This will require adding a check to some existing functions to make sure that a record doesn’t have a tombstone before it is displayed to the screen. After a session is finished, a Database destructor should be invoked, which copies nonnull records to a new data file, deletes the old data file, and renames the new data file with the name of the old data file. After this process completes, there should be no tombstoned records – deleted records should no longer be present in the database file. Submission When you are finished, zip up your source code and submit it on laulima. Be sure to indicate in a comment whether you implemented your project with Clion or Visual Studio (or some other IDE). I will grade your project with either Visual Studio or Clion, so your program must compile and run on one of them (If I have trouble compiling and running your code with Visual Studio I’ll switch to Clion, or vice versa; this will be true for all assignments this term). Make sure your code is in your zip file before you submit it. This project will be graded on a 20 point scale and will count toward the programming assignment portion of your grade.
Feb 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here