How to write a constructor

Assignment Help Programming Languages
Reference no: EM13935540

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);

Reference no: EM13935540

Questions Cloud

Indicate the important water quality constituents : A particular wastewater stream has dissolved oxygen (DO) concentration of 2.0 mg / L and a discharge rate of 0.5 m3 / s. The river into which it is being discharged has DO equal to 8.3 mg / L, a flow rate of 4.35 m3 / s and a temperature of 20 °C...
Do you think niagra ltd should use the consultant : The weights assigned to the factors are not adjusted by the computer, but the factor ratings are adjusted for each country that the consultant assesses. Do you think Niagra Ltd should use this consultant? Why or why not?
Which bacteria characteristically lack a cell wall : List the roles of each of the following individuals in the development of microbiology: Koch, Pasteur, Lister, van Leeuwenhoek, Redi, Tyndall, What is the major criterion for placing bacteria into groups?
Organizations marketplace position from an hr perspective : If so, what is it and how will you incorporate it? How can this report improve the organization's marketplace position from an HR perspective?
How to write a constructor : 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.
Explain the microassessment of country risk : Microassessment. Explain the microassessment of country risk. How could such an assessment be used instead to adjust a project's estimated cash flows?
Identify current diversity practices in the organisation : The report should be based on the learner's workplace or an organisation they are familiar with. If students do not have access to an organisation a case study is contained within your learning materials that you may wish to use.
What force must be exerted by the ground : What force F must be exerted by the ground on each of the main braked wheels at A and B to counteract the turning effect of the two propeller thrusts? Neglect any effects of the nose wheel C, which is turned 90° and unbraked.
Explain method of reducing exposure to existing country risk : Reducing country risk. Explain some methods of reducing exposure to existing country risk, while maintaining the same amount of business within a particular country.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd