Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment 2 – Coding Loops Task 1: 2 points Task 2: 3 point Task 3: 3 points Task 4: 2 points Task 1 Write a JavaScript program embedded in a HTML document with the following requirements: Ask the...

1 answer below »
Assignment 2 – Coding Loops
Task 1: 2 points
Task 2: 3 point
Task 3: 3 points
Task 4: 2 points
Task 1
Write a JavaScript program embedded in a HTML document with the following requirements:
Ask the user what the cu
ent hour is. If the hour is between 6 and 9, tell the user, “Breakfast is served.” If the hour is between 11 and 13, tell the user, “Time for lunch.” If the hour is between 17 and 20, tell the user, “It’s dinner time.” For any other hours, tell the user, “So
y, you’ll have to wait, or go get a snack.”
Sample Run 1:
Sample Run 2:
Task 2
Write a JavaScript program embedded in a HTML document with the following requirements:
Ask the user to enter the weekday number. Then use a switch statement to calculate the co
esponding weekday name.
Sample Run:
Task 3
Note: Use a loop in this program.
Write a JavaScript program embedded in a HTML document with the following requirements:
Create a conversion table using the following formula: C = (F − 32) / 1.8; Start with a Fahrenheit temperature of 20 degrees and end with a temperature of 120 degrees; use an increment value of 5. The table will have two columns, one for Fahrenheit temperature values and one for those same temperatures converted to Celsius.
Sample Run:
Task 4
Write a JavaScript program embedded in a HTML document with the following requirements:
· Request the user to enter a numbe
· Write on the html document a triangle out of the number as follow:
E.g. output: (let’s say the user entered number 10)
Your input number is 10.
10
11 11
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
· The triangle should have 6 rows.
· Use Comments explaining how the program works
· The user can enter any numbe
· Use nested loops
Hint: You can find a similar example in this link:
https:
www.w3schools.com/jsref/jsref_continue.asp
https:
www.w3schools.com/jsref/tryit.asp?filename=tryjsref_state_continue_label_nest
Sample Run:
1
Answered Same Day Nov 11, 2021

Solution

Mohd answered on Nov 13 2021
135 Votes
A2_LastName_FirstName/T1.html
A2_LastName_FirstName/T2.html
A2_LastName_FirstName/T3.html
A2_LastName_FirstName/T4.html
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here