For this assignment we are going to do some file IO. Attached is a database file with comma separated values. The values are in the format (index, first name, last name, address, city, state, zip). There are duplicates in this database file. Read in the database, remove the duplicates, and write a new comma separated database file without the duplicates. The index field in the new file must be sequential and start at one. Do not design your program to the provided data file. Your submitted program will be run against other files of the same format.
Prompt the user for the database file name. This file name is the path and the file name. For example "/home/student/lab8/Resource/database.csv". Do not assume the file is in a particular directory.
Open the database
Read in the records using a custom class to hold a record
Remove the duplicates
Write the scrubbed database as a new CSV file starting with 'new_' and the input database file name.
The index field in the new file must be sequential and start at one.
Write the new file to the same directory that the database file was read from. For example "/home/student/lab8/Resource/new_database.csv"
Create a class to hold a single data record.
Override the == operator to ease comparison and override the << operator to output the comma separated values.
Use the class constructor to receive a line from the database then parse the values or override the >> input operator.
Modify the string stream getline() delimiter to a comma. See http://en.cppreference.com/w/cpp/string/basic_string/getline (Links to an external site.)
Use a vector to contain your data records.
Do not read the zip code as an integer
While the provided database file contains valid data be aware of potential errors from bad data records. Do not go overboard on error checking.
Do not write your program just for the attached data file.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.