Question: This is to be coded in c++ Below is the contents of the CSV file: 1,Outdoors,13107-070,257,2.71 2,Computers,66389-0001,948,94.43 3,Movies,53808-0776,278,65.75 4,Baby,41250-416,310,99.52 5,Toys,64058-413,783,45.65 6,Electronics,56062-422,219,20.95 7,Games,37808-453,478,41.23 8,Books,0268-1154,976,65.17 9,Toys,17089-075,484,67.69 10,Automotive,68788-9852,501,71.57

This is to be coded in c++

This is to be coded in c++ Below is the contents of

Below is the contents of the CSV file:

1,Outdoors,13107-070,257,2.71

2,Computers,66389-0001,948,94.43

3,Movies,53808-0776,278,65.75

4,Baby,41250-416,310,99.52

5,Toys,64058-413,783,45.65

6,Electronics,56062-422,219,20.95

7,Games,37808-453,478,41.23

8,Books,0268-1154,976,65.17

9,Toys,17089-075,484,67.69

10,Automotive,68788-9852,501,71.57

11,Electronics,37000-265,189,27.97

12,Jewelry,0527-1414,68,32.81

13,Toys,64092-113,450,55.23

14,Clothing,14783-015,975,97.03

15,Baby,68084-045,809,55.3

16,Music,42507-158,362,56.92

17,Games,36987-1476,203,36.95

18,Kids,50844-428,606,20.93

19,Baby,0781-5234,430,16.24

20,Automotive,0378-1049,82,81.32

21,Music,64679-701,487,28.77

22,Outdoors,63739-141,195,83.23

23,Books,0268-1154,976,65.17

24,Baby,76519-1003,430,16.24

25,Games,65342-1393,496,69.07

26,Electronics,0409-9630,797,92.55

27,Jewelery,33261-028,500,66.3

28,Computers,66336-058,375,84.16

29,Outdoors,51672-1330,128,68.85

30,Movies,53808-0776,278,65.75

31,Beauty,48951-8130,725,83.42

32,Baby,59779-224,848,82

33,Industrial,55711-070,753,46.48

34,Industrial,76446-002,272,89.03

35,Sports,68151-2870,185,2.86

36,Toys,0245-0709,783,45.65

37,Games,49999-963,523,93.65

38,Beauty,52125-508,500,2.38

39,Toys,54092-381,783,45.65

40,Beauty,55154-6649,666,79.52

41,Jewelry,57664-327,46,10.28

42,Grocery,49738-453,317,29

43,Grocery,68382-792,266,48.63

44,Outdoors,0268-6731,335,70.04

45,Beauty,68788-9494,12,16.81

46,Beauty,52125-508,500,2.38

47,Outdoors,33261-144,809,2.95

48,Computers,0641-6040,104,88.13

49,Automotive,0781-3059,577,95.24

50,Kids,60429-038,459,29.68

51,Sports,10578-024,185,2.86

52,Toys,64092-113,450,55.23

53,Jewelry,55111-586,297,53.61

54,Automotive,30142-289,282,33

For this assignment we are going to do file IO. Attached is a database file with comma separated values. The values are in the format (index, department, item code, quantity, cost). There are duplicates in this database file. For this assignment 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. Program tasks: Prompt the user for the database file name. This file name is the path and the file. For example "/home/student/lab8/Resource/database.csv". Do not assume the file is in a particular directory Use a single prompt. Ask the user for the entire path and filename as a single string. Open the database file as input by the user Read in the records using a custom class to hold a record . There is no need to save the index number as this is generated during the output. . Remove the duplicates. Note: A duplicate is identified by comparing all four fields and each matches another record's contents. Split the user's input filename into two strings, not for the path and one for the filename. Add "new_" to the filename and then append the path with the new filename Write the scrubbed database as a new filename as a CSV (comma separated format) file. Write the new file to the same directory that the database file was read from. For example "/home/student/lab8/Resourceew database.csv" The index field in the new file must be sequential and start at one Some suggestions: .Create a class to hold a single data record. e Override theoperator to ease comparison and override the > input operator o Modify the string stream getline) delimiter to a comma. See http://en.cppreference.com/w/cpp/string/basic string/getline e Use a vector to contain your data records. As you input each new record from the file check to see if the new record has a duplicate already in the vector. If not then add the new record, else ignore and move on to read the next record. 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!