Question
Page 1 of 3 ASSIGNMENT 2 15 Points CIS 114 In EVERY file submitted (except graphics , JSON and XML files) you MUST place the
Page
1
of
3
ASSIGNMENT
2
15
Points
CIS
114
In EVERY file submitted (except graphics
,
JSON and XML
files) you
MUST place the
following
information
near
the top of the page
use JavaScript or HTML comments
depending on
the file type.
JavaScript c
omments are // (single line) or /* */ (multi
-
line)
HTML comments
use
--
This is a comment.
--
>
CSS files use
only
multi
-
line
/* */
comments.
Your Full Name
Your Email @my.smccd.edu
CIS
114 OL
File Name
Assignment #
Date
Your full name must ALSO appea
r in the title bar when HTML files are
displayed in
the browser. Use the
do this. 1 point will be
deducted for each
time a
file
is
missing
this or
any
of the above information.
1.
Do the following:
Read
c
hapter
s
4+5
in
Murachs
JavaScript and
jQuery
text
book.
The books files
can be downloaded from
Canvas.
Read the Block Bindings section
from
Un
derstanding ECMAScript 6
:
https://leanpub.com/understandinges6/read/#leanpub
-
auto
-
block
-
bindings
Follow all CIS 114 Programming Guidelines (see handout)
2.
Do
exercise
4
-
2
at the end of
chapter
4 (to be submitted)
.
3.
Do exercises 5
-
1 and 5
-
2 at the en
d of chapter 4 (NOT to be submitted).
4.
Develop an application that calculates the sales tax and total after the user enters the
subtotal and tax rate.
Page
2
of
3
A.
Download the
assignment 2
files from Canvas.
Open the HTML and
JavaScript files in
the sales_t
ax folder.
B.
In the JavaScript file, note that the $ function has been coded for you.
It gets
the
o
bject for the HTML element that i
s specified by the id attribute.
C.
Code an event handler (function) named processEntries() that gets the user
entries, calcu
lates the sales tax and total, and displays those results in the text
boxes.
Format the
sales tax and
total as currency with 2 places past the
decimal point.
D.
Code an onload event handler that attaches the processEntries() function to the
click event of the Calculate button. Then, test what you have so far.
E.
Add data validation to the
processEntries() function. The subtotal entry
must
be
a valid, positive number less than 10,000.
The tax rate should be a valid,
positive number
less than 12. The error messages should be displayed in
alert
dialog boxes, and the error messages should be:
Subtotal must be > 0 and < 10000
Tax Rate must be > 0 and < 12
F.
Add JavaScript that moves the cursor to the Subtotal field when the
application
starts and when the user clicks on the Calculate button.
G.
Add the JavaScript event handler for the click e
vent of the Clear button. This
should clear all text boxes and move the cursor to the Subtotal field.
H.
Add JavaScript event handlers for the click events of the Subtotal and Tax
Rate
text boxes.
Each handler should clear the data from the text
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started