Question: Course Project - Instructions ============================= In this project, you will complete the code for a quadratic equation solver. The following requirements must be met: 1.

Course Project - Instructions ============================= In this project, you will complete the code for a quadratic equation solver. The following requirements must be met: 1. Use the provided starter files: Quadratic Solver.html - HTML page Quadratic Solver.css - externally linked CSS Quadratic Solver.js - externally linked JavaScript Images (folder) - contains the required images 2. Add the missing input and output fields to the HTML file. There are comments in the HTML file that show where these fields must appear. 3. Add the event handlers to the HTML file. In response to user-initiated events, the event handlers call functions in the externally linked JavaScript file. There are comments in the HTML file that show where your handlers must appear. 4. Add the missing styles to the CSS file. The styles determine the presentation of the page. There are comments in the CSS file that show where your styles must appear. 5. Add the missing code to the JavaScript file. The code determines the dynamic behavior of the page. There are comments in the JavaScript file that show where your code must appear. Refer to the course project guidance document for additional assistance. 

Course Project - Guidance ========================= First, study the example output to understand the project's functionality. Next, study the starter files to gain an understanding of their design. HTML file changes ================= For help on the HTML file changes, refer to the following outlines: 01 Getting Started with HTML 02 Integrating Images 05 Formatting Content with Tables 06 Getting User Input with Forms CSS file changes ================ For help on the CSS file changes, refer to the following outlines: 07 Styling Content Using Cascading Style Sheets 08 Advanced CSS JavaScript file changes ======================= For help on the JavaScript file changes, refer to the following outlines: 10 JavaScript (part 1 - Introduction) 10 JavaScript (part 2 - Selection) 10 JavaScript (part 4 - Functions) 10 JavaScript (part 5 - Events) Global variables ---------------- Calculated values: These store the calculated values needed to output the results. String literals: These store the string literals needed to output the results. onLoadPage() function --------------------- To reset all the fields, call the reset() function. To get a reference to field "a", use document.getElementById("a"). To set the input focus to field "a", call its focus() method. calculate1RealSolution() function --------------------------------- This function is called when there is a single real solution. This function must assign its calculated value to the realSolution1 global variable. The calculation formula is: -b / (2 * a) That is, negative b divided by 2 times a. To follow the correct order of operations, use parentheses as shown. calculate2ComplexSolutions() function ------------------------------------- This function is called when there are 2 complex number solutions. This function must assign its calculated real part value to the complexSolutionRealPart global variable. The calculation formula is: -b / (2 * a) That is, negative b divided by 2 times a. To follow the correct order of operations, use parentheses as shown. This function must assign its calculated imaginary part value to the complexSolutionImaginaryPart global variable. The calculation formula is: absolute value(square root(-discriminant)) / (2 * a) That is, the absolute value of the square root of the negative of the discriminant, all divided by 2 times a. Use the Math object function abs() for absolute value. Use the Math object function sqrt() for square root. To follow the correct order of operations, use parentheses as shown. calculate2RealSolutions() function ---------------------------------- The 2 real solutions must be assigned to the global variables realSolution1 and realSolution2. The calculation formulas are: (-b + square root(discriminant)) / (2 * a) and (-b - square root(discriminant)) / (2 * a) That is, negative b plus (or minus) the square root of the discriminant, all divided by 2 times a. Use the Math object function sqrt() for square root. To follow the correct order of operations, use parentheses as shown. calculateDiscriminant() function -------------------------------- This function must return the calculated value of the discriminant. The calculation formula is: (b^2) - (4 * a * c) That is, b squared minus (4 times a times c). To calculate b^2, simply multiply b by b. To follow the correct order of operations, use parentheses as shown. output1RealSolution() function ------------------------------ Define a local variable, say sOutput, and assign it the string concatenation of: sSolutions2, realSolution1, and ".". Assign sOutput to the innerHTML property of the solutions field. To get a reference to the solutions field, use document.getElementById("solutions"). output2ComplexSolutions() function ---------------------------------- Define a local variable, say sOutput, and assign it the string concatenation of: sSolutions1, complexSolutionRealPart, " + ", complexSolutionImaginaryPart, "i and ", complexSolutionRealPart, " - ", complexSolutionImaginaryPart, and "i.". Assign sOutput to the innerHTML property of the solutions field. To get a reference to the solutions field, use document.getElementById("solutions"). output2RealSolutions() function ------------------------------- Define a local variable, say sOutput, and assign it the string concatenation of: sSolutions1, realSolution1, " and ", realSolution2, ".". Assign sOutput to the innerHTML property of the solutions field. To get a reference to the solutions field, use document.getElementById("solutions"). reset() function ---------------- Change each fields value to an empty string. Here is the code to do this for field a: document.getElementById("a").value = ""; The id's of the other fields to reset are b, c, discriminant, and solutions. solve() function ---------------- You must first get the field values for the a, b, and c fields. Here is the code to get the value for the a field: a = document.getElementById("a").value; To validate the fields, you must call the validateFields() function. Make sure to pass it the parameters a, b, and c. If it returns false, use a return statement to immediately exit the solve() function. To calculate results, call the calculateSolutions() function. Make sure to pass it the parameters a, b, and c. To output your results, first call the outputDiscriminant() function. Then call the outputSolutions() function. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!