In this assignment, you will write a program that will fill 3 boxes with fruits. Your program will get the fruits’ names, their weights and the capacities of the boxes from a file. You can get the file from the link :
- The program will attempt to fill these boxes with fruits one by one, starting from the first (Box1) and continuing with the next (e.g. Box2) until to the last (e.g. Box3) based on the following criteria:
- Either a box can be filled with the exact weight (ex. Box1 should get exactly 32 kg fruits)., or it will be skipped and left empty and the next box will be tried to be filled.
- Program will not use same fruit twice. (ex. If program have used apple for Box1, apple can’t be used again for next boxes).
- Program will write each boxes’ last situations to the result.txt file. If a box is full, the names of the fruits that are in that box must be written to the result.txt. If the box is empty, “Box-id: empty” must be written to the result.txt. Output file should look like as follows, note that following is sample output not the solution:
Box1: lemon, mango, …
Box3: apple, …