I'm trying to draw a diagram for the following problem statement. I need to create the function in JavaScript and call it in an HTML file.
"An invoice consists of a customer, a list of line items, and a date of purchase. Customers have contact names, addresses, telephone numbers, and an internal customer ID. Line items consist of an item and a quantity. Items have a description and a price."
For each object identified in the above, write a constructor. Also, create two methods that act on invoices. One should be addLineItem that adds a line item to an existing invoice. The other should calculateTotal that determines the total billing price of the invoice.
Here is what I have so far:
function invoice(customer, lineItems, dateOfPurchase){
this.customer = customer;
this.lineItems = lineItems;
this.dateOfPurchase = dateOfPurchase;
}
customer = contact names("Mike");
customer = address(1234 main st);
customer = telephone number (222-111-3333);
custimer = internal id (12345);