/* C programming */ Please do not use // for comments as the platform does not support C++ style comments. Expected Output format should be exactly the following format given in the description. please read every instruction to get the proper output. Also follow the function structure I have given after the description. You can copy paste it and start the coding there.
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_t type structures
employee_t employeelist [MAX_COMPANY_SIZE];
The employee_t is a structure typedef for struct employee. The struct employee contains the following fields
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. The birthday is a structure typedef for struct date. The struct date_t contains the following fields,
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 new employee to the employeelist through the terminal. You should collect the input by asking multiple questions from the user.
Enter birthday: day>
Enter birthday: month>
Enter birthday: year>
2. delete last employee
Remove the last employee from 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 01-01-1900 1.000 07
Pay attention to the strict formatting guide:
4. save the employee list to the database file
Save the employeelist in the hard disk as a binary/text file named database. 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 the database file and put the data into employeelist. You may only read the data files created by your own program. You should overwrite the employeelist array you had in memory when loading from the file.
6. exit the program
Exit the interactive program.
The database file
It is up to you to create your own data storage format for the database file. Your program should be able to read the database that was created by itself. You can create the database as a text or binary file.
You do NOT need to be able to create a database identical to the database of the sample executable. You do NOT need to be able to read the database of the sample executable.
First step for the assignment should be to read this specification very carefully. Then play with the sample executable. Understand how it works, try different inputs. You will only understand the task fully if you spend a reasonable time experimenting with the executable.
Breakdown the task into small measurable subtasks that can be achieved with functions, and then implement one at a time. Begin by taking small steps. Create a program that does not necessarily do all that is eventually required. Add to it slowly and methodically testing it on each occasion. Do not try to write a program that meets all the requirements in one step – this will not save you time.
TEST TEST TEST! Testing is a core part of programming. You should thoroughly test your program to make sure the behaviour is identical to the sample executable. We will provide you with test cases – think yourself. The more testing you do, higher your chances are to get a good grade for the functionality.
If your program crashes unexpectedly, or it runs but does not give the correct output, then you need to think of using a debugging strategy to determine the nature of the fault. For example, you can place printf() statements at significant points in your source code to print messages enabling you to trace execution of the program. You can also use comment delimiters to temporarily remove parts of the source code from the compilation process.
You will lose marks if you do not follow the instructions in the template file. Do NOT hard-code your solution.
When writing the code, the first step is to define the struct employee and struct date with the fields mentioned above – do NOT add extra fields. Inside the main, you can define the employeelist as an array of employee_t type – do NOT define this array as a global variable. To start with, assume all user input is perfect (within the range, correct datatype). Work on adding an employee, then on displaying the employeelist. You could then progressively work your way through other features.
Do not worry about some months not having dates 29-31 and leap years. That means 30-02-1900 is a real date, although the month of Feb does not have a day 30. Only the range conditions mentioned before apply.
All strings in C should be null-terminated i.e. the last character should always be ‘