Question: Using struct.c, as a starting point, implement an application that creates a database of employee personal records. Your implementation should follow these guidelines: the definition

Using struct.c, as a starting point, implement an application that creates a database of employee personal records. Your implementation should follow these guidelines:

  • the definition of the structure PERSON should be provided in an h-file called person.h that you need to create in the src sub-directory,
    • for the content, refer to the lecture notes,
  • typdef should be used for referencing the PERSON structure,
  • an array employees[] should be declared in the main C file (that is struct.c),
  • a new C file person.c needs to be created; person.c should include implementations of the following functions:
    • addEmployee() to read the person data from the standard input and to add it to the array,
    • displayEmployee() to display the data for a single employee,
    • displayAllEmployees() to display data for all employees,
  • the main program should read in the data for a number of employees by first prompting the user for the number of employees, allocating sufficient space for the employees in the array, and then calling the addEmployee() function to populate the current element of the array.

Here are the signatures of the functions that must be declared in person.h and defined in person.c:

void addEmployee(PERSON *employee); void displayAllEmployees(PERSON employees[], int numberOfEmployees); void displayEmployee(PERSON *employee);

#include  struct birthday { int month; int day; int year; }; "struct.c" int main(void) { struct birthday myBday; // - no new needed ! // then, use dot notation like in Java ! */ scanf("%d/%d/%d", &myBday.month, &myBday.day, &myBday.year); printf("I was born on %d/%d/%d ", myBday.month, myBday.day, myBday.year); return 0; } 

"person.c"

#include "person.h" #define INPUT_BUFFER_SIZE; void addEmployee(PERSON *employees){ printf(""); scanf("%d", &employees->age); } void displayAllEmployee(PERSON employees[], int numberOfEmployees){ } void displayEmployees(PERSON *employees){ }

"person.h"

#ifndef C_TUT_PERSON_H #define C_TUT_PERSON_H #include  typedef struct { int month; int day; int year; } DATE; typedef struct { char name[41]; int age; float height; DATE bday; } PERSON; void addEmployee(PERSON *employee); void displayAllEmployees(PERSON employees[], int numberOfEmployees); void displayEmployees(PERSON *employees);

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!