QuestionTHIS IS C PROGRAM! I have no clue to fix this problem, plz help…THIS IS C PROGRAM!I have no clue to fix this problem, plz help me!!!!!Even if there are lots of files but COMPLETE 4 files is(game.h,game.c,quart.c,quarter.h).=======assig2.c=====main program#include #include #include #include “node.h”#include “score.h”#include “game.h” /* Constants */ const char *TEAMS[2] = { “Carlton”, “Losers” }; // the names of the teamsconst int NUM_QUARTERS = 4; // the number of quarters in the game /* Global Variables */ game the_game; // the game! /* Functions*/ void read_in_data(){ const char *FILENAME = “scores.txt”; // the name of the text file const int LIMIT = 1000; // set to a small number, e.g. 10 when debugguing char *line; // a line of text from the file char *tokens; // the line of text broken up into a stream of comma separated tokens int quarter; // the value of the current quarter int raw_score; // the raw value of the current composite score FILE *fp; // the file itself score a_score; // a score int count = 0; // the number of lines (scores) read from the file // open the file fp = fopen(FILENAME, “r”); if (fp == NULL) { // couldn’t open the file, so quit fprintf(stderr,”Cannot open file.n”); exit(1); } else { line = (char *)malloc(100 * sizeof(char)); // read in all the score data, one line at a time while (fscanf(fp, “%[^n]n”, line) != EOF) { count++; // stop at LIMIT if required for debugging, and skip comments if ((count <= LIMIT) && (line[0] != '#')) { //printf("count is %dt",count); // uncomment when debugging //printf("%sn", line); // uncomment when debugging // break up input line into components tokens = strtok(line, ","); raw_score = atoi(tokens); tokens = strtok(NULL, ","); quarter = atoi(tokens); // score based on the components of input line init_score(&a_score, quarter, raw_score); // add created score to the game add_score_to_game(the_game,a_score); } } } fclose(fp);} /** Entry point*/int main(int argc, char *argv[]){ char heading[35]; // heading // create, print, and underline heading sprintf(heading, "%s v %s", TEAMS[0], TEAMS[1]); printf("%sn", heading); for (int i = 0; i < strlen(heading); i++) { printf("="); } printf("n"); // initialise collection init_game(&the_game); // read in data read_in_data(); // process and show the results show_quarter_scores(the_game); show_vert_worm(the_game); show_final_margin(the_game);}======assig2.h====#ifndef ASSIG_TWO122_H#define ASSIG_TWO122_H #include #include “node.h”#include “score.h”#include “quarters.h”#include “game.h” /* Types *///typedef node quarter_format; //JRD //typedef quarters *game_format; //JRD#endif =====score.h=======#ifndef SCORE_H#define SCORE_H struct score_int;typedef struct score_int *score; void init_score(score *sp, int q, int s);int get_quarter(score s);int get_team(score s);int get_worth(score s);void set_quarter(score s, int q);void set_team(score s, int t);void set_worth(score s, int w);char *to_string(score s, const char **TEAMS); #endif=====score.c======#include #include #include “score.h” /* Types */ struct score_int { int quarter; int team; int worth;}; /* Functions*/ /** ‘Constructor’ for score* Param sp pointer to score being constructed* Param q quarter number to be included* Param s coded score value to be included*/void init_score(score* sp, int q, int s){ // create space for the score *sp = (score)malloc(sizeof(struct score_int)); // update the quarter number (*sp)->quarter = q; // update the team number (*sp)->team = (s – 3 > 0) ? 1 : 0; // update the score switch ((s – 1) % 3) { case 0: (*sp)->worth = 6; break; case 1: (*sp)->worth = 1; break; case 2: (*sp)->worth = 0; break; }} /** Getter for quarter* Param s score variable to examine* Return quarter field*/int get_quarter(score s){ return (s->quarter);} /** Getter for team* Param s score variable to examine* Return team field*/int get_team(score s){ return (s->team);} /** Getter for worth* Param s score variable to examine* Return worth field*/int get_worth(score s){ return (s->worth);} /** Setter for quarter* Param s score variable to update* Param q value to be placed into the score’s quarter field*/void set_quarter(score s, int q){ s->quarter = q;} /** Setter for team* Param s score variable to update* Param t value to be placed into the score’s team field*/void set_team(score s, int t){ s->team = t;} /** Setter for worth* Param s score variable to update* Param w value to be placed into the score’s worth field*/void set_worth(score s, int w){ s->worth = w;} /** Display function* Param s score to be displayed* Param TEAMS const array of strings holding the team names* Return s formatted as a string*/char *to_string(score s, const char **TEAMS){ char *r=(char *)malloc(35*sizeof(char)); sprintf(r, “Quarter %d, %s for %s”, s->quarter, ((s->worth == 6) ? “a GOAL” : ((s->worth == 1) ? “a Behind” : “no score”)), TEAMS[get_team(s)]); return r;}=====node.c=====#include #include “node.h” /* Types */ struct node_int { void *data; node next;}; /* Functions */ /** ‘Constructor’ for node* Param np pointer to node being constructed* Param o value to place into data field*/void init_node(node *np,void *o){ *np = (node)malloc(sizeof(struct node_int)); (*np)->data = o; (*np)->next = NULL;} /** Getter for data* Param n node variable to examine* Return data field*/void *get_data(node n){ return (n->data);} /** Getter for next* Param n node variable to examine* Return next field*/node get_next(node n){ return (n->next);} /** Setter for data* Param n node variable to update* Param o value to be placed into the node’s data field*/void set_data(node n,void *o){ n->data = o;} /** Setter for next* Param n1 node variable to update* Param n2 value to be placed into the node’s next field*/void set_next(node n1, node n2){ n1->next = n2;} ====node.h====#ifndef NODE_H#define NODE_H struct node_int;typedef struct node_int *node; void init_node(node *np, void *o);void set_data(node n, void *o);void set_next(node n1, node n2);void *get_data(node n);node get_next(node n); #endif NEED TO BE COMPLETED AS BELOW=====game.h=====#include “node.h”#include “score.h”#include “quarters.h”#include “game.h” typedef struct game_format; // COMPLETE ME struct game_int;typedef struct game_int *game; void init_game(game *gp);game_format get_quarters(game g);int get_current_quarter(game g);void set_quarters(game g, game_format q);void set_current_quarter(game g, int n);void add_score_to_game(game g, score a_score);void show_vert_worm(game g);void show_quarter_scores(game g);void show_final_margin(game g); #endif=====game.c===#include #include #include “game.h” /* Constants */ extern const char *TEAMS[2]; // team namesextern const int NUM_QUARTERS; // number of quarters in the game /* Types */ struct game_int{ game_format the_quarters; int quarter_num;}; /* Functions */ /** ‘Constructor’ for game* Param gp pointer to game being constructed*/void init_game(game *gp){ // create the game COMPLETE ME // create the quarters COMPLETE ME // initialise the current quarter (game is yet to start) COMPLETE ME} /** Getter for quarters* Param g game variable to examine* Return the_quarters field*/game_format get_quarters(game g){ return g->the_quarters;} /** Getter for quarter number* Param g game variable to examine* Return quarter_num field*/int get_current_quarter(game g){ return g->quarter_num;} /** Setter for quarters* Param g game variable to update* Param q value to be placed into the game’s the_quarters field*/void set_quarters(game g, game_format q){ g->the_quarters = q;} /** Setter for quarter number* Param g game variable to update* Param n value to be placed into the game’s quarter_num field*/void set_current_quarter(game g, int n){ g->quarter_num = n;} /** Doer function to add a score to the game* Param g game variable to update* Param a_score value to be added to the game at the end of the appropriate quarter*/void add_score_to_game(game g, score a_score){ COMPLETE ME} /** Doer function to display vertical worm of the changing lead in the game* Param g game variable to process*/void show_vert_worm(game g){ COMPLETE ME} /** Doer function to display scores of requested and previous quarters in the game* Param g game variable to process*/void show_quarter_scores(game g){ COMPLETE ME} /** Doer function to calculate and display final margin in the game* Param g game variable to process*/void show_final_margin(game g){ COMPLETE ME}==quarter.c====#include #include #include “quarters.h” /* Types */ struct quarters_int{ quarter_format scores;}; /* Functions */ /** ‘Constructor’ for quarters* Param qp pointer to quarters being constructed*/void init_quarter(quarters *qp){ COMPLETE ME} /** Getter for scores* Param q quarters variable to examine* Return scores field*/quarter_format get_scores(quarters q){ return q->scores;} /** Setter for scores* Param q quarters variable to update* Param f value to be placed into the quarter’s scores field*/void set_scores(quarters q, quarter_format f){ q->scores = f;} /** Doer function to add a score to a quarter* Param q quarters variable to update* Param a_score value to be added into the quarters at the end of the appropriate quarter*/void add_score_to_quarter(quarters q, score a_score){ COMPLETE ME}==quarter.h====== #ifndef QUARTERS_H#define QUARTERS_H #include “node.h”#include “score.h” typedef struct quarter_format; // COMPLETE ME struct quarters_int;typedef struct quarters_int *quarters; void init_quarter(quarters *qp);quarter_format get_scores(quarters q);void set_scores(quarters q, quarter_format f);void add_score_to_quarter(quarters q, score a_score); #endifComputer ScienceEngineering & TechnologyObject-Oriented ProgrammingKIT 107Share Question