In this exercise, you’ll develop an application that calculates the sales tax and invoice total after the user enters the subtotal and tax rate.

computer science

Description

Total: 40 points

All assignments should be individual work. Discussion with class mates is allowed but the final code has to be written individually. If you take code from any Web site, provide the links in your submission files.

All the files you need for this exercise are available on Canvas->Course Schedule->A2.zip

Start early.

DO NOT USE jQuery or CSS to implement the programs. You can use CSS only for styling purposes. Solutions should be general enough so that if the size or content of arrays changes, your code will still work.

 

1.       (10) In this exercise, you’ll develop an application that calculates the sales tax and invoice total after the user enters the subtotal and tax rate.

a)      Open the HTML and JavaScript files provided in the folder sales_tax

b)      Then, run the application to see the user interface shown above, although that interface won’t do anything until you develop the JavaScript for it.

c)       In the JavaScript file, write the code for calculating and displaying the sales tax and invoice total when the user clicks on the Calculate button.

d)      Add the JavaScript event handler for the click event of the Clear button. This should clear all text boxes.

e)      If you haven’t already done so, add data validation to this application. The subtotal entry should be a valid, positive number that’s less than 20,000. The tax rate should be a valid, positive number that’s less than 10. The error messages should be displayed with span tags, and the error messages should be:

Must be a positive number less than 20,000
Must be a positive number less than 10

f)       Add JavaScript code that focuses the cursor to the Subtotal field when the application starts and when the user clicks on the Calculate button.

 

 

 

 

2.       (10) In this exercise, you start with the declarations for two arrays, a names array and a scores array. Then you will add one button that will display the scores and another button that will calculate and display the average score.


Related Questions in computer science category