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 program that displays a virtual object on real video

In this assignment, you will write a program that displays a virtual (i.e., graphics) object (e.g., a wire-frame cube, a teapot) on a real video sequence.

  Write an arm subroutine which allocate memory for new string

Prepare an ARM subroutine which will extract a substring from a string and you will need to use the library routine malloc to allocate memory for the new string - CS252 Programming Assignment

  Implement to do a matrix-matrix product

Implement and check the time to do a matrix-matrix product of a 1000x500 matrix with a 500x800 matrix of floats sequentially and using 1,2,3,4, and 8 threads on dual and quad core processors.

  What are the contents of given register

Memory location 2000H has the word 5000H stored in it. What does each location contain after INC BYTE PTR[2000H]. Also after DEC WORD PTR[2000H]

  Create security code program-display digit-ascii character

You have been hired to create the security code program. Program must permit user to enter message, one character at a time.

  Write program to enter name-number of planet from sun

Write down the program which permits the user to enter name of planet, and then prints message stating that planet's number when counted outward from sun.

  Users selection and return to menu

Create a menu that will allow the user to list all wines by name in alphabetic order and count all wines in each type and list all 5 types with their count

  Create a project in xcode

Create a new project in XCode using the Mac OS X/Command Line Tool template

  Give value of mytop and contents of the array

Assume that stack is the class described in this section with stacktype set to int and stack_capacity or mycapacity set to 5. Give the value of mytop and the contents of the array.

  Build a student record managing system application

Build a student record managing system application

  Produce a store procedure to accept parameters

Produce a store procedure named spBalanceRange which accepts three optional parameters. Procedure returns the result set consisting of VendorName,

  Develop a simple rentalcarcompany program for a rental car

Develop a simple RentalCarCompany program for a Rental Car Company, call it whatever you like. We will have two classes, a Car class and aRentalCarCompany class

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