I'm going to build my wife a home banking application so she can easily keep track of our finances.
I want it so that it you can input every credit to our bank account(wages etc). For each item of credit there will be 3 seperate input fields: date, amount, source(where it came from). These will store on a monthly baisis, withall moths being stored until the user deletes them (I don't know how many moths worth she needs to keep, at least 12 I'd say). And obviously doing calculations: adding the whole mothns credits, add every months total, adding every credit from a certain sorce etc.

Theres alot more but for the minute i will concentrate on the above.

Should I have Credit class with the attributes date, amount and source?

There's more but I won't ask it all on one longwinded post!

Thanks

Glen

Should I have Credit class with the attributes date, amount and source?

yes

What about the months? A Month class, but what collection of Credit objects should it hold? Would a Set do the trick?...................

Depends on whether you need them in a particular order or not. In general you should try to avoid worrying about that kind of detail too early. Concentrate on the public methods - from which you should return the most generic kind of object that makes sense, eg if Month has a getAllCredits method you can define that as returning a Set (order unimportant) or a List (in order). Later on you can decide what's the best class to use internally, and you can change your mind later still without breaking any other code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.