Part B – Use save-as and save Lab10axx.html as Lab10bxx.html
Add the function to calculate the numerical weighted average using the percentages below:
Lab 1-7 Average 20%
Lab 8-14 Average 25%
Project 10%
Test 1 grade 15%
Test 2 grade 15%
Quiz/HW average 15%
Hint: To calculate the weighted average multiply each average by the weight (the percentage divided by 100) and take the sum. So the overall grade is the sum of : the Lab 1-7 Average multiplied by .2, and the Lab 8-14 Average multiplied by .25 and . . . and the Quiz/HW average is multiplied .15.
Round the overall average using the JavaScript function: Math.round().
Write the rounded average into the Average Grade textbox using an assignment statement. Remember you use .value when referring to textboxes.
When you are not using a form you use document.getElementById(‘theid’).value = … to write to a textbox. (.value is for textboxes)
Use if statements and insert the letter grade A, B, C, D or F in the Letter Grade textbox OR you can use an if statement and insert Pass or Fail in the textbox.
If the rounded average is greater than or equal to 90
Replace the text in the h2 that said I hope I got the A! with text that says YES! I got the A! YEA!
And turn the background color of the h2 to green and the background color of the page to red.
If the rounded average not greater than or equal to 90 but is greater than or equal to 60 change the h2 to read OK, I Passed, Everything is Good!
Hint: Give the h2 an id and use an assignment statement using innerHTML
Carefully test your code and make sure it is correct. Test with different values. Are the results reasonable, are they correct?