CalculatorAssignment: You get to create a four function calculator. You will have two text fields for input, four buttons (one each for addition, subtraction, multiplication, and division), four functions (one for each operation), and one text field for output. You should control the layout of your calculator with a table. Notice the use of the parseInt() function. It functions to force a variable to be of type integer. If you don't use the parseInt function, then 6 + 6 will equal 66 because JavaScript will treat the two sixes as strings to be concatenated instead of two integers to be added. The plus sign is overloaded in JavaScript. This means that it performs two functions: Concatenation and addition. You shouldn't need to use parseInt with multiplication, division, or subtraction since these signs are not overloaded. |