Question: Project 3 : Comic List Processor Overview In this program, you will process a list ( s ) of comics from a CSV file. We

Project 3: Comic List Processor
Overview
In this program, you will process a list(s) of comics from a CSV file. Well be able to read them from a file, store them in an in-memory list, add to that list, maybe read more than 1 file. We will be able to buy comics and see how much that will cost. We can even save our in-memory list as a new CSV file that would allow us to reload that file into memory later on.
We will read and store the information in a struct called a Comic_List. A Comic_List is an array of Comic structs along with a maximum capacity for the array and a number of Comics currently in the array.
Details
You will be creating 2 structs in this assignment. It is a list of the Comics
struct Comic_List
{
struct Comic* list;
int size;
int count;
};
This is the one used in the sample solution. You do not need to use these exact field names, but you do have to store a dynamic array of the Comic struct, and you will need to keep track of the current number of comics in the list, count, and the current capacity for the list, size.
The Comic information needs to store the date, code, publisher, title, and cost. Here is the one from the sample solution:
struct Comic
{
char* date;
char* code;
char* publisher;
char* title;
char *cost;
};
Again, you may choose different names for your fields but you need to store all of this information. The cost is a char* because some of the costs are not numbers but rather are listed as AR
Example Data
Here are the first 10 comics from one of the files:
DATE,CODE,PUBLISHER,TITLE,PRICE
03/08/23,JAN231097,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover A Letizia Cadonici),$3.99
03/08/23,JAN231098,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover B Keyla Valerio),$3.99
03/08/23,JAN231099,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover C Fritz Casis Giant-Size X-Men #1 Homage Variant),$3.99
03/08/23,JAN231100,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover D Letizia Cadonici Virgin Variant),AR
03/08/23,JAN231101,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover E Keyla Valerio Virgin Variant),AR
03/08/23,JAN231102,ABLAZE PUBLISHING,Children Of The Black Sun #3(Cover F Fritz Casis Giant-Size X-Men #1 Homage Virgin Variant),AR
03/08/23,DEC220991,ABLAZE PUBLISHING,Traveling To Mars #4(Cover A Roberto Meli),$3.99
03/08/23,DEC220992,ABLAZE PUBLISHING,Traveling To Mars #4(Cover B Emilio Pilliu),$3.99
03/08/23,DEC220993,ABLAZE PUBLISHING,Traveling To Mars #4(Cover C Alessandro Amoruso),$3.99
03/08/23,DEC220994,ABLAZE PUBLISHING,Traveling To Mars #4(Cover D Brent McKee Marvel Premiere #1 Warlock Homage Variant),$3.99
The data starts with a header line that should be ignored, i.e. it is not stored in the array of comics.
If you look at the 4-6th comics (highlighted above) you can see the cost for those is listed as AR which means the cost has not been set yet. This is why we have the cost field stored as a char* in the Comic struct. When you are calculating the cost of buying comics later, you can use the atof() function to convert the char* to a floating point.
Reading in Comic Data
When you start reading this data in from the file, you should use static character arrays, also called buffers, that are large enough to store any length for the field. Since there are 5 fields for each comic, you should use 5 separate buffers.
The sample solution uses buffer sizes of:
100
100
100
1000
10
respectively for each of the fields listed. You are free to use these same sizes.
When you store the field in your struct, you must resize the string to be as short as possible to store just what is needed. For example, if your buffer is 1000 characters long, but the title is only 100 characters long then you will create, dynamically, a string to store only the 100 characters. (Dont forget to leave space for the null terminator). You do not want to waste the extra 899 bytes of memory by allocating for 1000 when you only need 100+1.
Commands
Please note: if you try to start coding this before thinking about how you are going to design it, you are going to end up with spaghetti code that will be AWFUL to debug. THINK before you code. Remember, the TAs are not your personal debuggers; you are responsible for debugging your own code, so design it in small units that are easy to test in isolation.
load
The load command should read in each line of the CSV file and store it into a Comic. That Comic should then be put into the Comic_List representing all of the comics in the current CSV file.
You may not read the line and simply store the line into the struct. Each piece must be broken up into its own field in the struct.
buy
The buy command should add the comic at a given list position to another list containing all of the comics we wish to buy. Note: In most implementations, you will have 2 lists (not required

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 Programming Questions!