Hello, I have tried to solve this problem but I cannot, its been over a week. I need help in designing the solution for this problem.

I need to make a system of food processing, food is inputted to machines, where it is processed and packed. If you can contact me in private it would be great. Thanks.

Hello, I have tried to solve this problem but I cannot, its been over a week. I need help in designing the solution for this problem.

I need to make a system of food processing, food is inputted to machines, where it is processed and packed. If you can contact me in private it would be great. Thanks.

I am not looking for you to do the work for me, I just need help planning it.

You haven't given us much to work with.
You might want to create a "Food" class. Maybe you should also create subclasses of the "Food" class for different foods.
And perhaps different foods can be inputted in specific types of machines so you have some business logic here.
Have a method in the Machine class that takes as argument a Food and based on what kind of food it is, it returns the result, which is probably some other class.

You haven't given us much to work with.
You might want to create a "Food" class. Maybe you should also create subclasses of the "Food" class for different foods.
And perhaps different foods can be inputted in specific types of machines so you have some business logic here.
Have a method in the Machine class that takes as argument a Food and based on what kind of food it is, it returns the result, which is probably some other class.

Hi I have designed the food part but I dont understand the machine part, is it possible u can send me ur email in a private message, then I can show u the scenario. Thanks.

Hi I have designed the food part but I dont understand the machine part, is it possible u can send me ur email in a private message, then I can show u the scenario. Thanks.

No this is a forum and people post their questions here.

Also the machine method will take as argument a food, process it and return another class.
What the method will do is up to you to decide. I don't know what kind of processing is required, that is up to you. You have been told to write something that processes food. Well ask whoever gave you the assignment how the food will be processed and what they want the result to be. Maybe it will be a class called "PackagedFood".

Maybe the idea is for you to think some processing ways. It is not difficult to say this:

Food tomato = new Food();
Food ketcup = process(tomato);

Now come up with other examples like this and think what attributes are required. Maybe instead of Food you will use subclasses of that class.

No this is a forum and people post their questions here.

Also the machine method will take as argument a food, process it and return another class.
What the method will do is up to you to decide. I don't know what kind of processing is required, that is up to you. You have been told to write something that processes food. Well ask whoever gave you the assignment how the food will be processed and what they want the result to be. Maybe it will be a class called "PackagedFood".

Maybe the idea is for you to think some processing ways. It is not difficult to say this:

Food tomato = new Food();
Food ketcup = process(tomato);

Now come up with other examples like this and think what attributes are required. Maybe instead of Food you will use subclasses of that class.

it is very hard to explain the problem, it is best if I send it you.

there are 3 types of food, which go as input to a process machine , after it has been processed its been passed to a packing machine.
The food has different spoiling time and if it goes past the spoiling time it should be removed, we have decided that the food should be in queues.

The thing is I havent written any code because I still need to plan it properly and that is the problem I am having.

Write out the project description and tell us, step by step, what you think you will need to do for each part. If we think you're wrong we can help but show effort or you'll get no help.

Write out the project description and tell us, step by step, what you think you will need to do for each part. If we think you're wrong we can help but show effort or you'll get no help.

The group has now been divided, my problem scenario is the following:

There are 2 packing machines, which can pack any type of food, however this needs to be done one at a time. Each food type takes 10 secs to pack.

The packing machines get the food from the processing machines, there are 3 processing machines. The food is stored in queues, the one with the shortest queue, the packing machine will get a food from that queue.

This is my problem:

I have thought about it, I need to add 2 queues to the packing machines because it has to store the food, do I need a queue or is an ArrayList fine?

The thing I dont understand is, how am I going to add the 10 seconds timer (10secs to pack a food).

private int packtime;

I know I need a field like this then I need to define it. Is this right or a static field?

Also how is it going to find which has the shortest queue? the .size method right? However, once this is done how will it just pick a food from the processing queue and add it to the packing machine queue/arraylist. One it is added, then somehow it will tell the packing machine and the processing machine queue will go down by1.

I am a beginner in java, so if I have made a lot of mistakes, please understand.

Edited 6 Years Ago by ben1: n/a

This article has been dead for over six months. Start a new discussion instead.