Question: I need C code for this question and I t DOESN'T NEED to be a very detailed or correct solution, it should look like a
I need C code for this question and It DOESN'T NEED to be a very detailed or correct solution, it should look like a question solution in general, just make up a coding solution for the question. So you can MAKE UP A SOLUTON THAT COVERS THE QUESTON, the important thing should be written in C language.






Write a C code for this question. Suppose we want to simulate a factory processing some product. The factory consists of processing units, each unit with an employee. And each employee can only take care of one product at a time. If a new product comes to this unit while the employee is dealing with a product, the product must wait in such a way that this employee remains empty again. When the unit finishes a product, it pushes the product into one of the next possible units according to the factory layout. Each product may follow a different route at the factory and exit the system after a product has been processed in an output unit. An example factory with 5 units is shown in the figure. In each factory, Unit 0 is the only unit operating as an input unit. It accepts the products and starts processing. Units with inbound and outbound connections are interfaces such as Unit 1 and Unit 2 in this example. There may be many output units that do not have an outgoing connection to another unit. In this example, Unit 3 and Unit 4 are output units. The schematic structure of the desired factory will also be given in the input file. isci Unit 1 Unt 3 Unto 1 i 1 Unit 2 Unit 4 The factory starts to work by waiting for products that come in sequence but not at the same time. Units may be idle, waiting for jobs, or busy processing. We assume that each unit has a unique processing time that is the same for all products. Once the process is complete, the product will be transferred to one of the next units at the factory in different possible ways. When choosing the unit to be transferred, the product will be transferred to the unit where it will wait the least. If the waiting time for more than one unit is equal, the product unit number will be assigned to the smaller unit. After the given input is processed, it will be utput as: 1) Total working time of the factory 2) Total working time of each unit (Total working time, idle time will not be counted.) 3) The exit time of each product given in the input (the time when they exit the output units ) (do not forget that the time spent at the factory will be added to their time ) will be produced. Input file format: The first line is the number of units in the system, (N). The next N rows are the factory layout represented as a list. Each line has the following format: UnitNumber, Processing Time, NumberOfUnits The ProductCan Transfer, Units That The ProductCan Transfer The next line is the product number, (J). The next line is the arrival time of the products to the factory. Floating point are positive values. The input file according to the example in the figure: 5 0 2.2364 212 14.568313 2 5.9876 2 34 3 3.89760 4 2.67890 20 0.3504 0.9768 1.3085 5.0263 5.1213 5.9992 6.4886 10.4749 11.8744 13.4648 14.2401 14.2904 14.6714 20.7265 26.4457 32.0276 35.0026 36.2470 38.0850 42.1120 Output file format: The first line is the total working time of the factory. The next N rows are the total run times of the units. Next J row is the time when the products leave the factory
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
