Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C PROGRAM HELP implement an application that creates a database of employee records. Your implementation will need to: Define the structure PERSON, in a header
C PROGRAM HELP
implement an application that creates a database of employee records. Your implementation will need to:
Define the structure PERSON, in a header file called person.h, which you will need to create in the src directory.
A typedef should be used to reference the stucture as PERSON instead of as struct person.
Create an employees array (an array of PERSON *s) in the main file.
In a new file, person.c, implement functions:
addEmployee : reads personnel data from the standard input, populates an element in the employees array.
displayEmployee : takes as input a pointer to a PERSON and displays (i.e. prints) the information for that
person in a readable format.
displayAllEmployees : to display all employees in the array (by calling displayEmployee on each element.
Finally, the main program (in struct.c) which will need to:
Prompt first for the number of employees.
Create the employees array with the correct size.
Call addEmployee the specified number of times.
You will first need to allocate space for a PERSON, and store the resulting PERSON * in the employees array.
Call displayAllEmployees.
Free all allocated space.
Here are the signatures of the functions that must be declared in person.h and defined in person.c:
void addEmployee(PERSON *employee);
void displayEmployee(PERSON *employee);
void displayAllEmployees(PERSON *employees[], int numberOfEmployees);
A sample run might look like:
How many employees?
4
Enter information for the next employee.
Name : Bob Ross
Age : 54
Height : 1.2
Birthday ( MM / DD / YYYY ) : 11/22/3333
Enter information for the next employee.
Name : Idk someone with a name
Age : 980
Height : 18.5
Birthday ( MM / DD / YYYY ) : 13 / 37 / 1337
Enter information for the next employee.
Name : Arnold Shwa... how2spell
Age : 72
Height : 180.3
Birthday ( MM / DD / YYYY ) : 7 / 30 / 1947
Enter information for the next employee.
Name : yes
Age : 1
Height : 1
Birthday ( MM / DD / YYYY ) : 1/1/1
Displaying Employees...
Bob Ross :
Age : 54
Height : 1.2
Birthday : 11/22/3333
Idk someone with a name :
Age : 980
Height : 18.5
Birthday : 13/37/1337
Arnold Shwa... how2spell :
Age : 72
Height : 180.3
Birthday : 7/30/1947
yes :
Age : 1
Height : 1.0
Birthday : 1/1/1
Process finished with exit code 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started