This is to be written in C and needs to use scanf, fscanf, printf, and fscanf where applicable. Should be simple but needs to be done no later than Monday Sept. 15th Here are the reqirements:
You are to implement an array that holds records (i.e. struct’s) with people’s names and income in dollars (rounded to the nearest dollar). The data should come from a data file that has its name passed as a command-line parameter. The file will have the following format:
<action-char> <last-name-string> <first-name-string><income>
where <action-char> is a single letter code:
‘a’ - add a record
‘p’ - print the income for a specified person (still read the dummy income data, but ignore it)
‘P’ - print all the records in income order from highest to lowest. This requires that you keep the array sorted (for this action char, still read both the name and income data, but ignore
<last-name-string> and <first-name-string> are up to 25 characters long.
<income> is an integer
To keep the array sorted, please use Insertion Sort
You can produce your own test file to start with and you will be provided with an official data file that tests all of the possibilities for bad input (such as, ‘p’ where the person is not found, ‘a’ attempting to add a person that’s already there).
This needs to be compiled in gcc.
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Written in C and compiled in gcc.