Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Program Average Columns Csv File Write C Program Parse Csv File Fields Separated Cha Q35542069

Write a program to average columns in a CSV file

Write a C program to parse a *.csv file where fields areseparated by the ‘;’ character and print out the average of eachcolumn (which is an integer), separated by the ‘;’ character.

Your executable file must be named avgcsv. It should take asargument the name of a csv file and outputs the average of eachcolumn, separated by ‘;’. You should print out the average to theprecision of 2 decimal points.

For example, suppose the contents of the example.csv are asfollows:

$ cat example.csv 10;25.5;5622;10;100.4

Then, the expected output of the command ./avgcsv example.csvshould be:

$ ./avgcsv example.csv16.00;17.75;78.20

We expect you to write a Makefile to generate the avgcsvexecutable file from your source code. Recitation 1 teaches you howto write a Makefile.

We do not provide you with any tests and will test your programunder a few csv files of our own choosing during grading time. Wehighly encourage you to write unit tests for your program.

Once finished, add relevant source files and Makefile to yourgit repo

Example of input files:

6;0;-5;-1;9;7;6;-5;6;-7-9;0;-6;1;8;0;1;8;4;-4-5;8;0;-9;-7;6;3;-8;-2;-89;7;1;8;-9;3;7;6;6;13;7;-4;9;-2;0;-4;0;0;-4-8;6;2;-3;0;1;3;2;-6;-10;-2;9;-6;2;-4;-9;7;-6;-19;0;-4;7;-7;3;5;6;4;8

-3;-2;3;-9;1;9;4;6;-3;-6

**Note: the existing chegg answer does not work

Leave a Reply

Your email address will not be published. Required fields are marked *