Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 1 A. Write JavaScript statements to accomplish each of the following ta

ID: 3710300 • Letter: Q

Question

QUESTION 1 A. Write JavaScript statements to accomplish each of the following tasks a) do...while structure: 0, 4, 8, 12, 16, 20, ..., 80 b) for structure: 100, 95,90, 85, 80, 75, ..., 5 c) while structure: 1, 3, 8, 10, 15, 17, 22, 24,29, 31, 36, 38 d) for structure: 20, 21, 22, 24, 26, 27, 28, 30 B. Write a JavaScript to generate output below 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 2 3 4 5 3 4 5 1 2 3 4 5 4 3 2 0 3 21 0 1 2 1 0-2 1 0 23 3 4 5 6 7 Write a JavaScript that prompts the user for the radius of a sphere, uses a function sphereVolume to calculate the volume of a sphere, and prints the volume and diameter of a sphere Write a JavaScript function named numKeyPad that return a number based on an input letter received that found on the telephone as shown in below: (Using switch statement) ABCDEF GHI JKL MNO PQRSTUVWXYZ

Explanation / Answer

<!DOCTYPE html>

<html>

<body>

<h4>a) Do While</h4>

<p id="doWhile"></p>

<h4>b) For</h4>

<p id="for"></p>

<h4>c) While</h4>

<p id="while"></p>

<h4>d) For loop</h4>

<p id="forLoop"></p>

<script>

var;

var num = 0;

do{

one += num + " ";

num += 4

}while(num <= 80);

document.getElementById("doWhile").innerHTML = one;

var two = "";

for (num = 100; num >= 5; num=num-5) {

two += num + " ";

}

document.getElementById("for").innerHTML = two;

var three = "";

num = 1

add = 2

while(num <= 38)

{

three += num + " ";

num = num + add;

if(add == 2)

add = 5;

else

add = 2;

}

document.getElementById("while").innerHTML = three;

var four = "";

for (num = 20; num <= 30; num=num+2) {

four += num + " ";

}

document.getElementById("forLoop").innerHTML = four;

</script>

</body>

</html>

a) Do While

0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80

b) For

100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5

c) While

1 3 8 10 15 17 22 24 29 31 36 38

d) For loop

20 22 24 26 28 30

<!DOCTYPE html>

<html>

<body>

<h4>a) Do While</h4>

<p id="doWhile"></p>

<h4>b) For</h4>

<p id="for"></p>

<h4>c) While</h4>

<p id="while"></p>

<h4>d) For loop</h4>

<p id="forLoop"></p>

<script>

var;

var num = 0;

do{

one += num + " ";

num += 4

}while(num <= 80);

document.getElementById("doWhile").innerHTML = one;

var two = "";

for (num = 100; num >= 5; num=num-5) {

two += num + " ";

}

document.getElementById("for").innerHTML = two;

var three = "";

num = 1

add = 2

while(num <= 38)

{

three += num + " ";

num = num + add;

if(add == 2)

add = 5;

else

add = 2;

}

document.getElementById("while").innerHTML = three;

var four = "";

for (num = 20; num <= 30; num=num+2) {

four += num + " ";

}

document.getElementById("forLoop").innerHTML = four;

</script>

</body>

</html>

a) Do While

0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80

b) For

100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5

c) While

1 3 8 10 15 17 22 24 29 31 36 38

d) For loop

20 22 24 26 28 30

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote