PDA

View Full Version : OOP assignment



mike_g
10-23-2007, 05:15 PM
I was given a Java assignment with a list of classes that should be included, but I'm thinking about getting rid of a couple because they seem pointless. Basically I have to make a shopping trolley prog. The 4 classes given are:

A Menu Class - which holds a list of items on the menu
A Menu Item Class - which holds details of each item on the menu
An Order Class - which holds a list of all items ordered
An Order Item Class - which holds a reference of each item ordered from the menu along with quantity.

Originally I coded my back end so that orders could be made from more than one menu, but apparently that was over complicating things as there would only be one menu, which made me think. If all items in an order ar drawn from the same menu, there is only one menu, and theres no point in having multiple 'order item' entries for the same 'menu item', then wouldent both the order, and order item class do nothing but complicate the program? Essentially there would be nothing notable left to differentiate the menu from an order. All I would have to do would be add a variable to each 'menu item' that holds the quantity sold and I could get rid of two of my classes. It seems to me as if that would greatly simplify the code. Is this a good idea? Its going against the spec, but it makes sense to me.

prog-bman
10-23-2007, 07:09 PM
When it comes to assignments, always follow the spec. Even when it seems dumb.