Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 A database file contains binary data (Check the sample data at the end of this document). The file contains a number of records,

image text in transcribed

Problem 1 A database file contains binary data (Check the sample data at the end of this document). The file contains a number of records, each record is stored as a "struct". struct employee \{ int Employee_ID; char name [20]; // Employee name first name then last name char address[50]; //The employee address might contains spaces //Both name and address are terminated by / / null character int job_code; // An integer between 1 and 12 float salary; \} The struct is written to the file using fwrite. The sample data contains one record with the following values. 123456, John Smith, 70 main St. Toronto, ON M3M 3M3, 9, 73123.45 Write a C program that performs the following - The file name is lab6_1.c - The file takes command line parameters (argc and argv) - If the command line arguments "-ID" followed by an integer, look for an employee with that ID in the file. If that ID exists, print the name on a line by itself. If There is no such ID print "No such employee" on a line by itself. - If the arguments "-s" followed by a number, prints the names and salaries of the employees with a salary that is equal to or greater than that number followed by a comma, then the employee salary, for example John Smith, 73123.45 - If the arguments is "-count" print the number of employees in the file - If the arguments are "-name" followed by a name that may contains spaces, look for an employee with the same name and display his/her salary. If no such employee exist, display "No such employee" - The quotes surrounding the arguments is for illustrative purpose only, they are not part of the input data, for example the actual input could be a.out s1234.56 - every displayed line ends with ' \

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

LO6.1 Discuss price elasticity of demand and how it is calculated.

Answered: 1 week ago