Write a menu driven program to create and operate on a relational database that, prospectively, can...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a menu driven program to create and operate on a relational database that, prospectively, can be used by a library. One relation is stored in one data file. Because these files can have different structure, the information about this structure is stored in the system catalog dbFiles maintained by your program (which should be created only the first time you run your program!). This information includes the names and the widths of all columns. Write functions/methods create Table (), insert (), remove(), printFile(), and purge() that operate on these files. The createTable () function creates a file whose name and size are entered by the user. Here is an example (the underlined entries are typed by the user): enter table name: books enter column name and its length: author 20 enter column name and its length: title 20 enter column name and its length: callNo 5 enter column name and its length: After this, the text file books.db is created and column names author, title, and callNo and their sizes are inserted in dbFiles. insert () allows you to add new entries (records) to a file. For example, you may have the following sequence of entries after choosing the insert option: enter file name: books author: Burnett Frances title: The Secret Garden callNo: MN432 More entries (Y/n): author: Wesley John title: Journal callNo: PQ945 More entries (Y/n): n remove() allows you to remove any record from any file. The prompts may be similar to those for inserting records. When deleting a record, put only a tombstone in the data file and continue running your program. A tombstone can be some special character - e.g., the sharp sign # - which is written over the first character in the record. printFile () displays the content of a file as a table with aligned columns and column names as captions. After exit is chosen from the menu, call the function purge () to process all the data files to be found in dbFiles. Purging consists in permanently removing from each file all the records marked for removal. BOOKS PEOPLE dbFiles file name Author Burnett Frances Wesley John Pushkin Aleksander Bernhardt Sarah Genlis Stephanie Byron George Wesley Charles Byron George SSN 123456789 987654321 999123456 column name size books Author 20 books Title 20 books CallNo people Name people SSN 5 20 9 Title The Secret Garden Journal Evgeny Onegin Memoires Memoires The Giaour Hymns Beppo Name Duff Jes Butler Donald Kazanopulos Demos CallNo MN432 PQ945 AB123 KL765 KL766 NN333 SD120 XY768 Write a menu driven program to create and operate on a relational database that, prospectively, can be used by a library. One relation is stored in one data file. Because these files can have different structure, the information about this structure is stored in the system catalog dbFiles maintained by your program (which should be created only the first time you run your program!). This information includes the names and the widths of all columns. Write functions/methods create Table (), insert (), remove(), printFile(), and purge() that operate on these files. The createTable () function creates a file whose name and size are entered by the user. Here is an example (the underlined entries are typed by the user): enter table name: books enter column name and its length: author 20 enter column name and its length: title 20 enter column name and its length: callNo 5 enter column name and its length: After this, the text file books.db is created and column names author, title, and callNo and their sizes are inserted in dbFiles. insert () allows you to add new entries (records) to a file. For example, you may have the following sequence of entries after choosing the insert option: enter file name: books author: Burnett Frances title: The Secret Garden callNo: MN432 More entries (Y/n): author: Wesley John title: Journal callNo: PQ945 More entries (Y/n): n remove() allows you to remove any record from any file. The prompts may be similar to those for inserting records. When deleting a record, put only a tombstone in the data file and continue running your program. A tombstone can be some special character - e.g., the sharp sign # - which is written over the first character in the record. printFile () displays the content of a file as a table with aligned columns and column names as captions. After exit is chosen from the menu, call the function purge () to process all the data files to be found in dbFiles. Purging consists in permanently removing from each file all the records marked for removal. Write a menu driven program to create and operate on a relational database that, prospectively, can be used by a library. One relation is stored in one data file. Because these files can have different structure, the information about this structure is stored in the system catalog dbFiles maintained by your program (which should be created only the first time you run your program!). This information includes the names and the widths of all columns. Write functions/methods create Table (), insert (), remove(), printFile(), and purge() that operate on these files. The createTable () function creates a file whose name and size are entered by the user. Here is an example (the underlined entries are typed by the user): enter table name: books enter column name and its length: author 20 enter column name and its length: title 20 enter column name and its length: callNo 5 enter column name and its length: After this, the text file books.db is created and column names author, title, and callNo and their sizes are inserted in dbFiles. insert () allows you to add new entries (records) to a file. For example, you may have the following sequence of entries after choosing the insert option: enter file name: books author: Burnett Frances title: The Secret Garden callNo: MN432 More entries (Y/n): author: Wesley John title: Journal callNo: PQ945 More entries (Y/n): n remove() allows you to remove any record from any file. The prompts may be similar to those for inserting records. When deleting a record, put only a tombstone in the data file and continue running your program. A tombstone can be some special character - e.g., the sharp sign # - which is written over the first character in the record. printFile () displays the content of a file as a table with aligned columns and column names as captions. After exit is chosen from the menu, call the function purge () to process all the data files to be found in dbFiles. Purging consists in permanently removing from each file all the records marked for removal. BOOKS PEOPLE dbFiles file name Author Burnett Frances Wesley John Pushkin Aleksander Bernhardt Sarah Genlis Stephanie Byron George Wesley Charles Byron George SSN 123456789 987654321 999123456 column name size books Author 20 books Title 20 books CallNo people Name people SSN 5 20 9 Title The Secret Garden Journal Evgeny Onegin Memoires Memoires The Giaour Hymns Beppo Name Duff Jes Butler Donald Kazanopulos Demos CallNo MN432 PQ945 AB123 KL765 KL766 NN333 SD120 XY768 BOOKS PEOPLE dbFiles file name Author Burnett Frances Wesley John Pushkin Aleksander Bernhardt Sarah Genlis Stephanie Byron George Wesley Charles Byron George SSN 123456789 987654321 999123456 column name size books Author 20 books Title 20 books CallNo people Name people SSN 5 20 9 Title The Secret Garden Journal Evgeny Onegin Memoires Memoires The Giaour Hymns Beppo Name Duff Jes Butler Donald Kazanopulos Demos CallNo MN432 PQ945 AB123 KL765 KL766 NN333 SD120 XY768
Expert Answer:
Answer rating: 100% (QA)
include include include include include using namespace std ofstream outFile ifstream inFile struct relation string tableName vector columnName vector columnSize vector dbFiles maintain all relations ... View the full answer
Related Book For
Statistics For Business And Economics
ISBN: 9780132745659
8th Edition
Authors: Paul Newbold, William Carlson, Betty Thorne
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Write an HTML document to create a form that collects favorite popular songs, including the name of the song, the composer, and the performing artist or group. This document must call one PHP script...
-
What happens to light when it falls on a material that has a natural frequency equal to the frequency of the light?
-
You have been asked to help your familys restaurants rethink their media planning, which includes two upscale Italian restaurants and a small chain of five grilled panini sandwich shops. Is there any...
-
The wreck of the S.S. Central America waited 130 years at the bottom of the ocean for someone to come along and claim its trove of gold. Thomas G. Thompson, funded by a multitude of investors, was...
-
The Sweet Smell Fertilizer Company markets bags of manure labeled "not less than 60 lb dry weight." The packaged manure is a combination of compost and sewage wastes. To provide good-quality...
-
Megan and Nancy each want save $250 000 for their retirement 40 years. a) Nancy begins her regular deposits immediately. How much must she deposit end 12% per year compounded annually achieve her...
-
The pie chart below shows how the total annual income for a certain family is spent. If the total annual income is 65,000, what amount is budgeted for Insurance, Food, and Savings combined? Savings...
-
If a firm is taking profits from one business unit and using them to grow another business unit, which diversification rational is the firm utilizing?
-
The Wiley Company is evaluating a capital budgeting project which is expected to have the following cash flows for time zero through year three: -$40,000, $23,000, $23,000, $23,000. What is the...
-
I was proposed to invest $750,000 today, to have an income of $62,000 at the end of each month; They will face expenses of $30,000 at the end of the first month and will have an increase of $500 each...
-
You have received the proposal to invest $1,000,000 in exchange for receiving income of $75,000 at the end of the first month that would decrease 0.3% each month starting from the 2nd month. Expenses...
-
Create a response that addresses: What objections or rebuttal could someone make to the arguments your peer has shared? How would you suggest the speaker address the potential objection or rebuttal...
-
How far can, and should, government control the economy
-
In Problems 1522, find the principal needed now to get each amount; that is, find the present value. To get $750 after 2 years at 2.5% compounded quarterly.
-
Let the random variable X follow a normal distribution with = 80 and 2 = 100. a. Find the probability that X is greater than 60. b. Find the probability that X is greater than 72 and less than 82....
-
Determine the sample size needed for each of the following situations. a. N = 1,650 = 500 1.96x-bar = 50 b. N = 1,650 = 500 1.96x-bar = 100 c. N = 1,650 = 500 1.96x-bar = 200 d. Compare and...
-
The Healthy Eating Index measures on a 100-point scale the adequacy of consumption of vegetables, fruits, grains, milk, meat and beans, and liquid oils. This scale is called HEI2005 (Guenther et...
-
When you were looking at goodwill in the previous chapter, you were interested in the difference between the amount received and the value of net assets. Why do we consider only the assets when there...
-
Alan, Bob and Charles are in partnership sharing profits and losses in the ratio 3:2:1 respectively. The statement of financial position for the partnership as at 30 June 2016 is as follows: Charles...
-
At 31 December 2017, the statement of financial position of A, B and C, who are equal partners, was as follows: A retired at that date. In order to determine the amount due to him the following...
Study smarter with the SolutionInn App