Question
Part 1 : Create a Web Page with a Script Tag (1 point) As you did in the previous coding assignments, create a web page
Part 1 : Create a Web Page with a Script Tag (1 point)
As you did in the previous coding assignments, create a web page called
For instance, I would create a file called:
michael_makabali_hw3.html
and then create a simple HTML document with a single header1:
Results of the Function Calls
----- FORMAT ABOVE ----
Part 2 : Replace the Javascript Code in Web Page (4 Points)
The output of your javascript code:
Part 2.1: Create the following variables in your script tag (1 point)
name (and assign it your name)
test_score_1 (and assign it the value of 100)
test_score_2 (and assign it the value of 80)
--------------------------------------------------------------------------------------------------
Part 2.2: Create the following function (2 point)
Function 1: compute_average
compute_average(score1, score2)
This function will calculate the average score of the two scores and return the average. In this case, the calculation is easy:
return (score1 + score2) / 2;
Function 2: print_result
This function will print the sentence above: "
print_result(name, average)
Use the document.write to print the results.
Part 2.2: Call the functions you created (2 point)
Use the name, test_score_1, and test_score_2 to call your functions. For example:
var average = compute_average(test_score_1, test_score_2);
print_result(name, average);
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