Language: C++ Overview The Final Project is to develop a simple database system.
ID: 3813417 • Letter: L
Question
Language: C++
Overview
The Final Project is to develop a simple database system. The database is to handle multiple records, each composed of several fields. The database will store its information to a file, addition and deletion of records, field modifications, and it will allow users to sort records based on the selected keys, and produce reports (output) according to predefined criteria.
Some definitions:
A database is a collection of information, or data, that you can organize, update, sort, search through, and print as needed. A database does not just hold information; you use a database to organize and analyze information so that you understand its significance.
A database file consists of one or more records. Each record holds all the information about one subject item. In C++, theclass data type provides an efficient way to represent and manipulate records.
Each piece of information in a record is called a field. Fields store the data that has been entered or calculated. In C++ parlance, fields are nothing more than the member variables defined for a particular class.
Given the requirements as a rough specification, you are to design the class and implement the database. So you can consider the requirements below as an outcome from a meeting with a client. You are in full control of the choice of data structures (except the main data structure of a Binary Search Tree, more detail below), algorithms, internal file format, and detailed user interface scheme.
You're designing and implementing a database for an address book. Users should be able to browse, search their contacts, by any field (last name, first name, zip code etc.) from the database, and organize their chosen contacts to their liking and print out a report. Each contact information includes followings:
Unique ID number. ID is a 9 digit number (assume person has an ID generated from another system)
First name
Middle name (or initial)
Last name
Company name
Home phone
Office phone
Mobile number
Street address
City
State
Zip code
Country
List of affiliates (such as family members or associates name). Each affiliate has first name, and last name. They may have one individual mobile phone number and one email. This database will not track any other information about affiliates. The total number of affiliates is unknown.
Requirements
Database overall management
Use a text based menu for users to choose available features. Program should have a main menu at the beginning and sub menus depending on the task.
You should allow users to read and write data to a text-based database file. The format of the text-based database file is following:
All information is stored in ASCII text format.
Records are divided by a | character
Each field is distinguished by a new line.
When reading from a data file, your program must test the input file to ensure that data is of valid format (basic error detection).
The database is primarily organized with the ID# as a key. You must use the provided Binary Search Tree (from HW8) for the base data structure. You will have to modify this code to ensure that you have a Binary Search Tree of Nodes, that is sorted by ID. You may have additional Binary Search Trees if that fits into your design. While you can modify the HW8 files, do not use some "other" Binary Search trees that you might find in the book or the internet, since we won't be able to help you if things go wrong (and they will!)
Each component of the overall program should be fairly modular.
Each menu item, for example, should be a separate function. The menu feature should be handled by a separate function and not by main( ).
Program should be fairly fault tolerant of user input (both when the user is entering data, and making menu choices). Provide appropriate user prompts and on-screen directions
Split the program into multiple files based on the roughly categorized functionality.
Data Retrieval and Modification
Users should be able to search records based on the field information in two modes: exact and contains. For example, search contacts by last name "Smith", search contacts with an email domain name that contains "ucdenver", etc. So in the search sub menu, users have to pick the search mode and field. Of course users should type in the search item.
Quite often, searches may generate a relatively big output. Users should be able to search again within the search result (secondary search) or start all over again from scratch (new search).
Since the entire data is structures in a Binary Search Tree tree with the ID# key, any search (except using ID#) should traverse the entire tree.
Users should be able to delete a record. So, in the delete record sub menu, users should be able to search and pick a delete candidate record. After deletion, the Binary Search Tree should follow all Binary Search Tree properties (with regard to sorting order, tree levels etc).
Users should be able to modify fields in a record, with the same condition above.
Users should be able to insert new records. There should be no restriction to the number of records in the database. So, in other words, you should not consider a fixed array for the record data structure.
Users can modify records, so the user should be able to write back to file (overwrite to current file or to a new file name similar to "save as").
Output Generation
Output generation is responsible for the re-organizing the final result to a user's liking by displaying appropriate fields and sorted records. The final output is a report in ASCII-text format.
After a series of data retrieval and modification, finally there is a list of contacts to be an output. Users should be able to further organize the contact and convey them to the output by choosing only the fields they want to print in desired order. So users should be able to pick fields to be finally shown in the output. And users should be able to sort the final output contacts by selecting a field as a key.
Users should be able to perform a secondary sorting with the second sort key (e.g., sort by company name, and then last name).
Output file generation in text file format.
Users should be able to generate a report output in ASCII text format. Note that this output file is different from the database file in ASCII text format.
Keep in mind that an output may not include all fields and records.
Node.h
BSTree.h
BSTree.cpp
databasefile:
117094337
Roderick
L.
Coons
Grey Global Group Inc.
(324)257-3210
(888)475-6767
roderick.coons@grey.com
(920)615-7364
85840 30th Lane
Cheyenne Wells
MO
29353-4042
United States
Troy Borges,(636)553-5433,tborges2450@oic.biz;
Bob Corcoran,(808)368-6692,bcorcoran@comcast.net;
Mike Franklin,(340)784-9249,mfranklin@qwest.com;
Audie Boren,(567)906-9017,aboren5@yahoo.com;
Archie Packard,(308)686-9564,apackard@oic.biz;
|
974483133
Freeman
J.
Packard
Phillips Petroleum Co
(630)377-8516
(877)211-8282 x6520
freeman.packard@phillips.com
(972)740-4928
85181 Fort Knox Lane
La Junta
AZ
61871-6105
United States
Delmy Johnson,(557)856-2645,djohnson9@biblegateway.org;
Troy Boudreau,(918)833-5566,tboudreau7@yahoo.com;
|
418140907
Jeanie
Susan
Davenport
Landstar System Inc.
(266)504-6836
(877)681-3380
jdavenport@landstar.edu
(231)823-5890
8590 52nd Circle
Drake
IA
91037-7295
United States
Xavier Cope,(929)657-8039,xcope95@xyz.org;
Raye Gillespie,(861)215-2528,rgillespie@mail.live.com;
Evelin Corona,(911)278-9026,ecorona@wph.org;
Hong Asbury,(247)828-8526,hasbury@xyz.org;
Lauren Bills,(956)913-5108,lbills2496@comcast.net;
Starr Crenshaw,(224)777-7633,screnshaw@hotmail.com;
Nigel Ashton,(820)460-5685,nashton@comcast.net;
output :
Explanation / Answer
import java.io.*;
class FIFO
the amount of inputs :”);
n=Integer.parseInt(br.readLine());
int inp[]=new int[n];
System.out.println(“Enter the inputs:”);
for(int i=0;i<n;i++)
inp[i]=Integer.parseInt(br.readLine());
System.out.println(“—————“);
for(int i=0;i<3;i++)
fifo[i]=-1;
int Hit=0;
int Fault=0;
int j=0;
boolean check;
for(int i=0;i<n;i++)
if(check==false)
}
System.out.println(“HIT:”+Hit+” FAULT;”+Fault);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.