Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If this is homework, it may not matter... But - if this is going to be used in a real-world app, I would strongly recommend against using concrete classes for each food item ie. Coke class, Salad class, Rice class, etc. as recommended above. This is a sure way to make your application inflexible.</p> <p>It would be much better to have a food item class and a drink class with a name property or some such.. </p> <p>Imagine having to rebuild your whole application just because there is now a new special or food item... not cool ;).</p> <p>I think what is missing from the other answers is the idea of a group. Each food item could belong to a group along with other items, or by itself.</p> <p>Say fries, rice, and wedges belong to group A. Drinks belong to group B. Then you could model a combo as a list of groups - ie. 1 group A item and 1 group B item, or two group A items and1 group B item.</p> <p>You could also make food items able to belong to multiple groups at the same time... to make the options more flexible.</p> <p>The db model could get complicated defining all of the relationships, but I think it's necessary.</p> <p>Perhaps something like this:</p> <p><code>group(id, name, desc)</code> - group of like items - entrees, appetizers, drinks... or anything</p> <p><code>foodItem(id, name, desc)</code> - represents a single item - fries, rice, etc.</p> <p><code>foodItem_group(foodIgem_Id, group_Id)</code> - maps food items to their group - many to many</p> <p><code>combo(id, name, desc)</code> - describes a combo</p> <p><code>combo_group(combo_Id, group_Id)</code> - maps groups to combos - many to many</p> <p>I think this would do for representing the basic required model - you may want additional tables to store what the customer actually ordered.. and of course detecting if a customer order matches a combo is left up to your business logic.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload