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

  Summary of the technical experiences that you used

Create the logic for a program that accepts input values for the projected cost of a vacation and the number of months until vacation. A summary of the technical experiences that you used in completing this lab. The commands that were of greatest be..

  Write function template which accepts array

Write a function template arraySum () which accepts array and number of values stored in it and returns the sum of those values.

  Html5 assignment i need an assignment for html5 containing

i need an assignment for html5 containing 2 parts1 3 pages html5 website2 report more important than the website

  How do we convert string values from keyboard to numeric

Let's discuss how to use the Java I/O classes such as the system and the scanner classes to do console IO and the JOptionPane class to do dialog based IO. How do we convert string values from keyboard to numeric values

  Write statement to determine whether array elements are full

Write the statements needed to determine whether any of the the array elements are null or refer to the empty String. Set the variable hasEmpty to true if any elements are null or empty-- otherwise set it to false.

  Write html page to enter city current temperature

Write HTML page that asks user to enter city current temperature and changes background color depending on that temperature.

  Evaluate the arithmetic expressions

Prepare a Lisp program to evaluate the arithmetic expressions - If the input is legal, your program should output the final result of the expression evaluation, as given in the above case. If the input is illegal, the result is undefined, i.e., you..

  Draw and implement class which contains instance data

Draw and Implement the class called "Box" which contains instance data (all doubles) that represents height, width, and depth of the box. Also include boolean variable called "full" as instance.

  Write program to show percentage of calories come from fat

Write a program which asks user to enter number of calories and fat grams in a food item. The program must display percentage of the calories that come from fat.

  Write program to compute contestant-s score

Performer's final score is determined by dropping highest and lowest score received, then averaging remaining scores. Write a program which uses this method to compute a contestant's score.

  Arguments for and against allowing mixed-mode arithmetic exp

1). State your own arguments for and against allowing mixed-mode arithmetic expressions.

  Develop the algorithms needed for designer robot

You have been hired as a system designer to develop the algorithms needed for a designer robot that can paint different patterns on the floor based on the commands it receives.

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