Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A company has 300 employees; each employee\'s record contains employee\'s name,

ID: 3534910 • Letter: A

Question

A company has 300 employees; each employee's record contains employee's name, age, marital status, and number of dependents if any. President of company asked for program to identify and print the record as follows:

Total number of employees who are not married and their records.
Total number of employees who are married and have no dependent.
Total number of employees who are married and have dependents.
(Use 4 one- dimensional arrays and draw a flowchart for the program)

I've been stuck on this problem for awhile. Thank you for the assistance!

Explanation / Answer

#include<stdio.h>

typedef struct emp

{

char name[20];

int age;

int maratial;

int dependents;

}emp;

int main()

{

int i,temp;

char nam[20];

// scanf("%d",&n); // number of employees

emp * a[301];

//insert records of employess;

for(i=1;i<300;i++)

{

a[i]=(emp*)malloc(sizeof(emp));

scanf("%s",nam);

a[i]->name=nam;

scanf("%d",&temp);

a[i]->age=temp;

scanf("%d",&temp);

a[i]->maratial =temp; //0 if not married else 1

scanf("%d",&temp);

a[i]->dependents=temp;

}

for(i=0;i<300;i++)

{

if(a[i]->maratial==0)

{

printf("name:%s age:%d maratial status:%d dependents:%d ",a[i]->name,a[i]->age,a[i]->maratial,a[i]->dependents);

}

if(a[i]->maratial==1 && a[i]->dependents==0)

{

printf("name:%s age:%d maratial status:%d dependents:%d ",a[i]->name,a[i]->age,a[i]->maratial,a[i]->dependents);

}

if(a[i]->maratial==0 && a[i]->dependents>0)

{

printf("name:%s age:%d maratial status:%d dependents:%d ",a[i]->name,a[i]->age,a[i]->maratial,a[i]->dependents);

}

}

return 0;

}

//if you have any doubts feel free to contact me

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote