Introduction to JavaScript To earn credit for this assignment: 1. You will create a JavaScript program – embedded on an HTML file - according to the requirements listed on the next page. 2. Upload and...

please see the file below


Introduction to JavaScript To earn credit for this assignment: 1. You will create a JavaScript program – embedded on an HTML file - according to the requirements listed on the next page. 2. Upload and submit a single html file (.html extension) containing the code required. PROBLEM DESCRIPTION You are required to create a webpage to implement a program to calculate taxes owed based on the logic designed on the previous flowchart and pseudocode. The webpage will include JavaScript code in order to calculate the amount of tax owed. You will also follow a precise sequence of inputs and outputs in your program As a reminder, the tax rates and deductions allowed are listed below: · Tax rates: EarningsTax Rate 0 to $20,000 10.00% More than $20,000 to $100,000 20.00% More than $100,000 35.00% ◦ Note: Amount of Tax owed: Earnings x Tax Rate · Deductions (reduce the tax owed amount): ◦ Pensioner: $1,000 ◦ Investor in renewable energy: 5% of invested amount ◦ Donations to charities: 10% of donated amount Inputs: · Earnings amount · Pensioner: Yes or No · Investor in Renewable Energy: Yes or No ◦ If Yes: request amount invested · Donations to charities: Yes or No ◦ If Yes: request amount donated Output: •Tax Amount owed Follow the sequence of input/output steps below: 1. Prompt to get the Earnings Amount. 2. Prompt to get the Pensioners status. (Y,N). 3. Prompt to get the Investor status (Y,N) a. If Yes: prompt for amount invested. 4. Prompt to get the Donor status (Y,N) a. If Yes: prompt for amount donated. 5. Alert to display the tax amount owed. SAMPLE TRACES THROUGH THE CORRECT ALGORITHM Sample 1 Sample 2 Inputs: Earnings 75,000 39,000 Pensioner Yes No InvestorYesNo Amount 20,000 Invested Donor No Yes Amount donated 500 Output: Tax Amount $13,000$7,750 owed Additional Information: · Be sure to include a comment with your name and section in the part of your HTML code program. · Since the content of a text box - which is what the prompt() function generates - is going to be used in mathematical operations, use the function Number() to ensure that the numeric input is treated as numeric data. Syntax example: numericVariable = Number(numericVariable) · To simplify the comparison of text data entered by the user, it is often easier to convert this text to upper case using the notation below. Syntax example: textVariable = textVariable.toUpperCase(); (See https://www.w3schools.com/jsref/jsref_toUpperCase.asp for additional example.) · Syntax example for prompt function: var myName = prompt(“Enter your name”); · Syntax example for alert function: alert(“My name is “ + myName); · Syntax example for displaying a number with a precision of 2 decimals: alert(“The number is “ + someNumber.toFixed(2)); · You will use several variables in this program. · It is good practice to store the 1000 pensioner deduction in a variable. This way it may be used in the process of calculating the tax amount. Point Values Student name inserted as comment in the section 1 Screen flow 4 Variables: naming, declarations 4 prompt() functions 4 alert() functions 4 IF statements 4 Program execution 4 References: · Recitation sessions · Lectures · Fluency textbook Chapter 17 - Fundamental Concepts Expressed in JavaScript Page 1 of 4 Page 1 of 4 Page 1 of 4
Oct 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here