All programs should be able to compile with no warnings when compiled with the –Wall option. Your Makefile must use the –Wall option on all gcc lines. We will be taking points off for warnings. You should put your name(s) in a comment on the first line of each file. You will find my executables as well testing files in ~ssdavis/30/p8. User inputs are in bold. The prompts and output format of each program must match the examples exactly.

#1 (5 points, 5 minutes) Filename: readSalaries.c

Write a program that prints out the information of specific records stored in the binary file salaries.dat by using fseek() and fread(). Your program may not use an array of SalaryInfo. salaries.dat is created by the executable createSalaries.out that is compiled from createSalaries.c that stores the information using the SalaryInfo struct listed below. The information is read from salaries.csv. All four of these files are available in ~ssdavis/30/p8. You may assume that there will be no errors in the use of your program so there is no need for error checking of any kind.

typedef struct
{
char occupation_title[31];
int employment;
double percent_of_total_employment;
double median_hourly_wage;
double mean_hourly_wage;
double annual_mean_wage;
} SalaryInfo;
[ssdavis@lect1 p8]$ head -4 salaries.csv
Occupation title,Employment,Percent of total employment,Median hourly wage,Mean hourly wage,Annual mean wage
All Occupations,7546400,1,27.87,34.43,71610
Office and Administrative Supp,1671920,0.2216,16.47,17.89,37210
Computer and Mathematical Occu,1174180,0.1556,37.86,39.93,83050
[ssdavis@lect1 p8]$ readSalaries.out
Please enter an index (-1 = done): 0
All Occupations: Employment: 7546400, Percent of employment 100.00%
Median hourly wage: $34.43, Mean hourly wage: $27.87
Mean annual wage: $71610

Please enter an index (-1 = done): 1
Office and Administrative Supp: Employment: 1671920, Percent of employment 22.16%
Median hourly wage: $17.89, Mean hourly wage: $16.47
Mean annual wage: $37210

Please enter an index (-1 = done): 550
Pest Control Workers: Employment: 0, Percent of employment 0.01%
Median hourly wage: $20.67, Mean hourly wage: $20.67
Mean annual wage: $43000

Please enter an index (-1 = done): 2
Computer and Mathematical Occu: Employment: 1174180, Percent of employment 15.56%
Median hourly wage: $39.93, Mean hourly wage: $37.86
Mean annual wage: $83050

Please enter an index (-1 = done): -1
[ssdavis@lect1 p8]$

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.