Question: A05-Structures Due: March 5th Points: 20 Clone Clone this repo to your local machine using the VS Code button on GitHub Classroom or by manually




A05-Structures Due: March 5th Points: 20 Clone Clone this repo to your local machine using the VS Code button on GitHub Classroom or by manually running a git clone command Description This assignment you will use your knowledge of structures. In this assignment, you will write a program that builds and updates some employee database (array of structures). You will make use of structures, file input/output, dynamic memory allocation, and command line arguments. Your program should do the following: - Take the name of an input file - This file will contain a list of employee information and operations as described below - Validate that an argument has been provided, otherwise print the expected command line arguments in an error message, and exit - Validate that the file was open correctly, otherwise exit - Read in the input file - You can assume all input will be valid - The first line contains the number of employees that will be entered - Space in memory should only be allocated for the exact number of employees, no more, no less - It then contains, each on a new line, an employee's name ( 25 chars), age, title ( 25 chars), and salary - After the information for each employee has been entered, a loop of operations should start - The operations will be read in from the same file - The loop should not terminate until the exit operation code is encountered (0) - The loop should not terminate until the exit operation code is encountered (0) - The operations are outlined below, they are to be entered each on separate lines Requirements Make sure to use the following concepts: - Structures - File input/output - Dynamic memory allocation - Command line arguments - Functions where appropriate - Control flow structures (loops and conditionals) Your code needs to support the following operations: - Exit - Update Employee Name - First line is the number/index of which employee (starts at 0) - Second line will be the name to be changed to, with the same restrictions as above, remove newlines - Update Employee Salary - First line is the number/index of which employee (starts at 0) - Second line is the salary the employee now has - Increase Employee Salary by Percentage - First line is the number/index of which employee (starts at 0) - Second line is the ratio to scale by ( 5% would be 1.05) - Increase all Employee Salaries by Percentage - First line is the ratio to scale by Program lnC Your code needs to support the following operations: - Exit - Update Employee Name - First line is the number/index of which employee (starts at 0) - Second line will be the name to be changed to, with the same restrictions as above, remove newilines - Update Employee Salary - First line is the number/index of which employee (starts at 0) - Second line is the salary the employee now has - Increase Employee Salary by Percentage - First line is the number/index of which employee (starts at 0) - Second line is the ratio to scale by (5\% would be 1.05) - Increase all Employee Salaries by Percentage - First line is the ratio to scale by - Update Employee Title - First line is the number/index of which employee (starts at 0) - Second line will be the title to be changed to, with the same restrictions as above, remove newlines - Employee Birthday (Age increases by 1) - First line is the number/index of which employee (starts at 0) - Print Employee Info - First line is the number/index of which employee (starts at 0) - The employee should then have their information printed - Print All Employee Info - All employees should have their information printed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
