0..* 1..* +-------+ +--------+ |Invoice|_______________________|Products| +-------+ | +--------+ |inID | | |proID | |inDate | | | Qty | +-------+ | | Price | | +--------+ +-----------+ |LineProduct| +-----------+ | Qty | | salePrice | +-----------+ Is this coding correct for the above class diagram ?
Class Invoice { inID:int; inDate:Date; } Class LineProduct { Qty:int; salePrice:int; //inID:int; <-- this is what I did but I am wrong //prodID:int; <-- this is what I did but I am wrong } Class Products { prodID:int; Qty:int; Price:int; } Now for example if an invoice consists two products I have to pass instance of objects to the DB functions like this
invoiceTable.saveInvoice(invoice:Invoice); lineproductTable.saveLine( product instance 1 ); lineproductTable.saveLine( product instance 2 ); now again another confusion that the line product table will have inID and proID columns but how to pass an object which will have inID and prod ID ?
PS:Sorry I am stuck in low rep I couldnt post an image and explain my confusion