Question
please help me answer this question please help . identify and describe all the functions given at coding below ( at least 5 function) prepare
please help me answer this question please help .
identify and describe all the functions given at coding below ( at least 5 function)
prepare the algorithm and flowchart for the 5 function u choose
include
void getEmployeeById();
void getEmployeeSalaryLessThan();
void AddEmployee();
void RemoveEmployee();
void GetTotalSalaryForEmployee();
int EmpId[100];
char **EmpName;
int EmpSalary[100];
int EmpGender[100];
int EmpAge[100];
bool isCurrentEmployee[100];
int numberOfEmployees = 0;
int EmployeeId = 10101;
int main()
{
int yesOrNo = 999;
do
{
int choice;
printf("Please choose one of the Choice below: ");
printf("1.Add Employee ");
printf("2.RemoveEmployee ");
printf("3.getEmployeeById ");
printf("4.getEmployeeSalaryLessThan Range ");
printf("5.getAllEmployee ");
printf("6.GetTotalSalaryForEmployee ");
scanf_s("%d", &choice);
switch (choice)
{
case 1:AddEmployee();
break;
case 2:RemoveEmployee();
break;
case 3:getEmployeeById();
break;
case 4:getEmployeeSalaryLessThan();
break;
case 5:getAllEmployee();
break;
case 6:GetTotalSalaryForEmployee();
break;
}
printf("do you want to continue: yes:1 or No 2");
scanf_s("%d", &yesOrNo);
} while (yesOrNo == 1);
return 0;
}
void getAllEmployee()
{
printf(" =====================================");
printf("All Of the employees are: ");
printf(" Id Name Salary Gender Age ");
for (int i = 0; i < numberOfEmployees; i++)
{
printf(" %d %c %d %c %d", EmpId[i], *EmpName[i], EmpSalary[i], EmpGender[i], EmpAge[i]);
}
}
void getEmployeeById()
{
int id;
printf(" =====================================");
printf(" Emter the Employee Id you want to see:");
scanf_s("%d", &id);
printf(" The Employee With ID: %d", id);
for (int i = 0; i < numberOfEmployees; i++)
{
if (EmpId[i] == id && isCurrentEmployee[i] == 1)
{
printf(" %d %c %d %c %d", EmpId[i], *EmpName[i], EmpSalary[i], EmpGender[i], EmpAge[i]);
}
else
{
printf(" Employee Not Found with Id: %d", id);
}
}
}
void getEmployeeSalaryLessThan()
{
int salaryRange;
printf(" =====================================");
printf(" Emter the salary you want to find employees who are getting less:");
scanf_s("%d", &salaryRange);
printf(" The Employee whoose salary lessthan: %d", salaryRange);
for (int i = 0; i < numberOfEmployees; i++)
{
if (EmpSalary[i] < salaryRange && isCurrentEmployee[i] == 1)
{
printf(" %d %c %d %c %d", EmpId[i], *EmpName[i], EmpSalary[i], EmpGender[i], EmpAge[i]);
}
else
{
printf(" No Employee Have less salary than: %d", salaryRange);
}
}
}
void GetTotalSalaryForEmployee()
{
printf(" =====================================");
int totalSalary = 0;
for (int i = 0; i < numberOfEmployees; i++)
{
if (isCurrentEmployee[i] == 1)
{
totalSalary = totalSalary + EmpSalary[i];
}
}
printf(" The Total Salary giving for all Employees is :%d", totalSalary);
}
void RemoveEmployee()
{ int id;
printf(" =====================================");
printf(" Emter the Employee Id whoom you want to Remove:");
scanf_s("%d", &id);
printf(" Removing Employee : %d", id);
int temp = 999;
for (int i = 0; i < numberOfEmployees; i++)
{
if (EmpId[i] == id && isCurrentEmployee[i] == 1)
{
isCurrentEmployee[id] = 0;
temp = 0;
}
}
if (temp == 0)
{
printf(" Removed Employee Successfully!!");
}
else
{
printf(" Employee Not found to Remove!!");
}
}
void AddEmployee()
{
EmployeeId = EmployeeId + 1;
char name[100];
int salary;
char gender;
int age;
printf("Employee Name: ");
scanf_s("%s", name, sizeof(name));
printf("Employee salary: ");
scanf_s("%d", &salary);
printf("Employee gender: ");
scanf_s("%c", &gender,1);
printf("Employee age: ");
scanf_s("%d", &age);
numberOfEmployees = numberOfEmployees + 1;
EmpId[numberOfEmployees] = EmployeeId;
EmpName[numberOfEmployees] = name;
EmpSalary[numberOfEmployees] = salary;
EmpGender[numberOfEmployees] = gender;
EmpAge[numberOfEmployees] = age;
isCurrentEmployee[numberOfEmployees] = 1;
printf(" Success fully Added Employee: %d", EmpId[numberOfEmployees]);
}
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