# Thread: Sorting and Mixing

1. Member
Join Date
May 2016
Posts
2
Rep Power
0

## Sorting and Mixing

Hi, I am developing a model to simulate a farm. A farm would have multiple barns to house chickens, all the chickens in one barn would arrive on the same day but different barns would be filled at different time. So if there are 10 barns at this farm,

Barn 1: chickens in the barn would be there for 65 days
Barn 2: chickens in the barn would be there for 60 days
Barn 3: chickens in the barn would be there for 55 days
Barn 4: chickens in the barn would be there for 40 days
Barn 5: chickens in the barn would be there for 35 days
etc.

When barns of chickens have been there for ~ 65 days (+/- 5 days), then the chickens in each barn would be sorted by weight into 3 groups (low weight, medium weight, high weight) and re-group, so the first 3 barns satisfy the ~ 65 days condition

Barn 1 (65 days): L1, M1, H1
Barn 2 (60 days): L2, M2, H2
Barn 3 (55 days): L3, M3, H3

After sorting,

Barn 1: L1, L2, L3
Barn 2: M1, M2, M3
Barn 3: H1, H2, H3

I hope this makes sense. I have no idea how to approach this. Please help. Thank you so much.

2. ## Re: Sorting and Mixing

Make a list of the steps the code needs to do to solve the problem.
Some of the steps may require further work, but can be left for now.
The main thing is to lay out the logic needed to solve the problem.
Work on the steps you have one at a time. Write the code, compile, fix errors and repeat. Then execute to see if there are errors.

One of the classes you need would be a Barn that contains chickens and has a time of arrival.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•