Question
Create a Web page that does the following. Write a function computeTax(itemCost,taxRate) to compute the sales tax of the item (i.e. ItemCost x taxRate). Be
Create a Web page that does the following. Write a function computeTax(itemCost,taxRate) to compute the sales tax of the item (i.e. ItemCost x taxRate).
Be sure to place the function declaration in the head section of your document, inside script tags. Then in the body section, add script tags and include JavaScript code that prompts the user to input the cost for the item and taxRate to pay. Store this input in two variables, itemCost and taxRate. Then write a function call to computeTax, passing the values input to the functions. The computeTax function will compute the tax and returns the value to the caller. The value will be displayed using the alert box (i.e. "Your tax amount is $1.60 ")
- Your computeTax function must return the computed tax value using the "return" keyword. - Your computeTax function should not have alert and document.write in it. The output should be displayed by the main body - Do not use console.log to display results. You must used either alert box or document.write. - you must use prompt as taught in class - You must declare variables - You must use document.write or Alert output- You must use parseFloat - You must Personalize the page with your photo on the top - You must NOT use console.log, Input, Type, Events - These are advanced topics. This was not part of the lecture.
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