Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Data Engineers regularly collect, process and store data. In this task you will develop a deeper understanding of how C programming language can be used for collecting, processing and storing data. In...

1 answer below »

Data Engineers regularly collect, process and store data. In this task you will develop a deeper understanding of how C programming language can be used for collecting, processing and storing data. In this assignment you get the opportunity to build an interactive program that can manage a list of employees in a company.

The list is stored as an array of employee_ttype structures

employee_t employeelist [MAX_COMPANY_SIZE];

The employee_tis a structure typedef forstruct employee. Thestruct employeecontains the following fields

  • name- array of MAX_NAME_SIZE chars (string)
  • fte- a float between 0.0 and 1.0
  • level - unsigned integer between 7 and 18
  • birthday- a structure of date_t type as defined below.

The variable fte indicates if an employee works full-time or part-time for a company. The value fte=1.0 (or 0.5) indicates that an employee works full time (or half-time) for the company.

Note that we now have a struct nested within a struct. Thebirthdayis a structure typedef forstruct date. Thestruct date_tcontains the following fields,

  • day- unsigned integer between 1 and 31 (inclusive)
  • month- unsigned integer between 1 and 12 (inclusive)
  • year- unsigned integer between 1800 and 2017

Your program interacts with the nested struct array in your memory (RAM) and simple database file in your hard disk. It should provide the following features:

1. add employee

Add a newemployeeto the employeelistthrough the terminal. You should collect the input by asking multiple questions from the user.

Enter name>
Enter birthday: day>
Enter birthday: month>
Enter birthday: year>
Enter FTE>
Enter level>

2. delete last employee

Remove the lastemployeefrom the employeelist. TIP: you cannot delete an element from an array. Instead consider using an integer to keep count of number of employees.

3. display employee list

Display the list of employees in the following format as shown in the sample run.Please follow the sample executable for the exact display format, including white spaces.

Name Birthday FTE Level
---------- ---------- ----- -----
bee XXXXXXXXXX 07

Pay attention to the strict formatting guide:

  • Name - left aligned, 10 chars at most.
  • Date - 2 digit day, 2 digit month, 4 digit year
  • FTE – 3 decimal places for the fractional part
  • level - 2 digits

4. save the employee list to the database file

Save the employeelistin the hard disk as a binary/text file nameddatabase. You may use your own format to save the data. You should overwrite if database file already exists.

5. read the employee list from the database file

Read thedatabasefile and put the data into employeelist. You may only read the data files created by your own program. You should overwrite the employeelistarray you had in memory when loading from the file.

6. exit the program

Exit the interactive program.

Answered 2 days After Sep 29, 2021

Solution

Vaibhav answered on Oct 01 2021
134 Votes
#include #include #include #define MAX_COMPANY_SIZE 5
#define MAX_NAME_SIZE 11
struct date
typedef struct {
unsigned int date;
unsigned int month;
unsigned int year;
} date_t;
struct Employee
typedef struct {
char name[100];
float fte;
unsigned int level;
date_t birthday;
} employee_t;
**
* @
ief adds the details of an employee to the list. If invalid details are
* provided the employee is not added to the list.
*
* @param empList the list in which the new employee details will be added.
* @param empCnt the index where the new employee data will be placed.
* @return int value 1, if the employee was added to the list, else 0.
*
int addEmpLoyeeToList(employee_t empList[], int empCnt);
**
* @
ief Display the all the details of all the employees cu
ently present in
* the employee list in a well formatted format.
*
* @param empList the list which contains the details.
* @param empCnt the total number of employees details to be displayed
*
void displayEmployees(employee_t empList[], int empCnt);
**
* @
ief writes the cu
ent list of employees to the DB. This ove
ides any
* existing data present in the file.
*
* @param empList denotes the list containing employee data that will be stored
* to the database.
* @param empCnt the total employees present in the database.
* @param fileName filename to which the data is to be written.
*
void writeEmployeesToDB(employee_t empList[], int empCnt, const char* fileName);
**
* @
ief reads the data of the employees
*
* @param empList denotes list of employees which will be populated with the
* employees data.
* @param fileName the name of the file from where the data is to be read.
* @return int returns the total number of records read from the database.
*
int readEmployeesFromDB(employee_t empList[], const char* fileName);
**
* @
ief Displays the initail menu for user's choice.
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here