Using the two structures below, write a C Program which can fill and initialise the structures like this with data read from the attached files: manufacturers.txt and models.txt. For each of the 5 records in the models.txt file, the program should print: The model name The number of employees involved in the model’s production The manufacturer’s longName, The manufacturer’s shortName The total number of employees in the manufacturer’s company Sample output PASSAT, 100, VOLKSWAGEN, VW, 2000 Notes Arrays should be used to hold the collection of structs. One array for the model structs and one array for the manufacturer structs. You can use strcmp() function to compare two strings (e.g. the manufacturer names). struct manufacturer{     char longName[11];     char shortName[3];     unsigned int numEmployees; // total number of employees in the company }; struct model{     char modelName[11];     unsigned int numEmployees; //number of employees involved in the model’s production     struct manufacturer aManufacturer; }; two files are ---------------------------- models2.txt FOCUS 100 FORD KA 200 FORD CEED 400 KIA PASSAT 100 VOLKSWAGEN SPORTAGE 200 KIA ---------------------------------------------------- manufactures.txt VOLKSWAGEN VW 10000 FORD FD 30000 SEAT ST 12000 KIA   KA 15000

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Using the two structures below, write a C Program which can fill and initialise the structures like this with data read from the attached files: manufacturers.txt and models.txt.

For each of the 5 records in the models.txt file, the program should print:

The model name

The number of employees involved in the model’s production

The manufacturer’s longName,

The manufacturer’s shortName

The total number of employees in the manufacturer’s company

Sample output PASSAT, 100, VOLKSWAGEN, VW, 2000

Notes

Arrays should be used to hold the collection of structs. One array for the model structs and one array for the manufacturer structs. You can use strcmp() function to compare two strings (e.g. the manufacturer names).

struct manufacturer{

    char longName[11];

    char shortName[3];

    unsigned int numEmployees; // total number of employees in the company

};

struct model{

    char modelName[11];

    unsigned int numEmployees; //number of employees involved in the model’s production

    struct manufacturer aManufacturer;

};

two files are

----------------------------

models2.txt

FOCUS 100 FORD
KA 200 FORD
CEED 400 KIA
PASSAT 100 VOLKSWAGEN
SPORTAGE 200 KIA

----------------------------------------------------

manufactures.txt

VOLKSWAGEN VW 10000
FORD FD 30000
SEAT ST 12000
KIA   KA 15000

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,