Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
A class system that represents produce available at a farmers market.
The classes should build a farmers market and allow the assigning of farmers to available stands.
It should also be able to access each farmer and their list of produce.

Creating a user interface is a bonus.
If anyone is able to explain the UI, it should be able to show:

farmers and location in the market

produce available for each farmer

search for a piece of produce and return a list of farmers that carry the item, along with their location in the market.

Any advice/tips/help are greatly appreciated!

Thanks A Million!!!!
Posted
Updated 20-May-15 9:53am
v3
Comments
Richard Deeming 20-May-15 16:00pm    
1. Do your own homework.
2. Don't "bump" your question.
Member 11706555 20-May-15 16:16pm    
I was proposed with this problem and I need advice and help because I am confused and professor has not taught this subject matter. If you are unable to help or suggest solutions/guidance and not be polite, then please leave and not comment so someone with the intelligence and respect can respond. Thanks!
Sergey Alexandrovich Kryukov 20-May-15 16:22pm    
I'm sorry for you insufficient education or possibly inadequate assignments; it happens. But to get help at this forum, you need to ask some reasonable question. Unfortunately, we don't have resources to do the alternative professor's work for you; it would take too much time and would go well beyond the format of this forum. You did not even provide sufficient detail to discuss anything. Your problem may turn to be quite simple. Perhaps you are the one to do the next step; what have you tried so far?.
—SA
Member 11706555 20-May-15 16:37pm    
What I am not understanding is what the professor actually wants. I was thinking he may have wanted a programmed excel file. He said he was just paying attention to the class designing skill, which was never discussed in class either. I have goggled and understand the concept but don't know exactly how to start it
Richard Deeming 20-May-15 16:32pm    
"please leave and not comment"
"someone with the intelligence and respect"

With an attitude like that, I suspect the problem is nothing to do with your professor.

To determine the objects/classes find the main 'nouns' in the problem e.g farmer, market, produce.
To make variables determine the properties of these objects.
The methods are 'what' do you need to do to these objects/properties- 'verbs'.
 
Share this answer
 
Comments
Member 11706555 20-May-15 18:11pm    
Thank You So Much! I really appreciate this. I was so confused on where to start.
Despite it being more than easy for you to figure this out yourself, here is some code to get you started:

C#
//
public class FarmersMarket
{
    public IEnumerable Farmers { get; }

    public IEnumerable GetFarmersWithProduce (IProduce produce)
    {
        foreach( Farmer farmer in this.Farmers )
        {
            if( farmer.Produce.Contains(produce) )
            {
                yield return farmer;
            }
        }
    }
}

//
public class Farmer
{
    private List _produce;

    public Farmer ()
    {
        _produce = new List();
    }

    public MarketStand Stand { get; set; }

    public IEnumerable Produce { get; }


    public void AddProduce (IProduce produce) { _produce.Add(produce); }
}

//
public class MarketStand
{
    public Point Location { get; set; }

    public Farmer Farmer { get; set; }

    public IEnumerable Produce { get { return this.Farmer.Produce; } }
}

//
public interface IProduce
{
    string Name;
    double Price;
}   {
    string Name;
    double Price;
}


Hopefully this is at least along the lines of what you were needing. Just expand from here now that you have a basic structure.
 
Share this answer
 
Comments
Member 11706555 20-May-15 18:25pm    
Thank you for this example. I was unsure on where to start. How did you develop your skills in this subject matter. I have ben studying OOP in my textbook and was unable to figure anything out. Out of all my programing classes, my professor has never went this far into our material to explain OOP or anything else leading up to it. Let's not even state how I just graduated with my BS degree I feel as if I got played....
FrostedSyntax 21-May-15 18:57pm    
I started learning in high-school on Java, which is also an object oriented programming language, and after my third year of programming I took up C# which is very similar to Java in syntax. However, despite your view that you were not taught well, all the resources you need are available online. Google is a programmer's best friend so use it.
Here is a link to a helpful reference to get you started: https://msdn.microsoft.com/en-us/library/dd460654.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900