7. Method Name: dayActivity Parameters: one parameter, day Return value: none Purpose: This function accepts one...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. Method Name: dayActivity Parameters: one parameter, day Return value: none Purpose: This function accepts one parameter named day. It will use a switch statement to test if the day is one of several days. It then outputs a phrase based on the day. 7.1. Declare a variable, output using the let keyword. 7.2. Implement a switch structure and switch on the value of the day parameter. Set the value of the output variable based on the following values Day Output value Monday Not again! Wednesday Half way there! Friday Sunday TGIF! Sunday Funday! All Other Days Just another day! 7.3. Log the output to the Console. 8. Method Name: print Table Parameters: none Return value: none Purpose: This method a multiplication table to the console 8.1. Implement a nested loop structure to output the multiplication table of from 1 to 5. Multiply each number from 1 to 5 with numbers from 1 to 5. (See sample output for format). 8.1.1. Log the output to the console in the format "1*2-2" 8.2. Insert linebreaks as appropriate using \n characters! Work on the JavaScript file and define the following methods. 4. Method Name: average Parameters: none Return value: none Purpose: This method should calculate the average of all numbers from 1 to 10 4.1. Declare any variables you need with restricted scope within the method using the let keyword. 4.2. Implement code to calculate the average of all numbers from 10 10 (inclusive). Use a for loop. 4.3. Output the average to the console using the log function. 5. Method Name: isEven Parameters: one parameter, number Return value: boolean Purpose: This function accepts one parameter value and returns a boolean value indicating if the parameter was even or not. 5.1. Declare any variables you need with restricted scope within the method using the let keyword. 5.1.1. Use the remainder operator (%) and the equal value & type comparison operator (===) 5.2. Return true if number is even and return false if number is odd 6. Method Name: testNumber Parameters: one parameter, number Return value: none Purpose: This method receives a number as a parameter value. It should invoke the isEven function to test if number is even or not. It should then log the result to the console. 6.1. Use the isEven function 6.1.1. Invoke the isEven method and pass it number as an argument. 6.1.2. Store the return value in another variable, evenNumber, declared with restricted scope within the method using the let keyword 6.2. Test the evenNumber variable 6.2.1. Based on the value of evenNumber, log to the console whether the number is even or odd. Sample Output - HTML Rendering Average of 1 to 10 Test Number 6 Test Number 245 Day Activity Tuesday Day Activity Sunday Print Table Sample Output - Console О Group sunte messages Sunday: Sunday Funday " Tuesday: Just another day! Contd... Sunday: Sunday Funday! 1-1-1 1-2-2 2-1-2 2 2 12 4-3-12 16 2-3-6 2 4 5-2-10 5-3-15 3+2+6 5-4-20 3-3-9 3-4-12 2.1. Create a new HTML file. Save the file as javascriptbasics.html. 2.2. Add html, head, meta charset, title, and body tags. 2.3. Set the title of the page to "JavaScript Basics" 2.4. Add a script element within the head element of the HTML page. 2.5. Set the source of the script to script.js 2.6. Add a new external JavaScript file and save it as script.js 2.7. Add your name, assignment #, class, and class time as a comment at the top of the both HTML and the JavaScript files. e.g, John Smith, AS, CIS 235, 9 am Work on the HTML file 3. Add button elements to the HTML body 3.1. Create the buttons as seen below in the table. Set the button text as described. 3.2. Add onclick attributes for each of the buttons 3.2.1. Invoke the corresponding JavaScript function as an event handler. 3.2.2. If an argument is listed, pass the argument within the inline function call. Button name Average Of 1 To 10 Test Number 6 onClick event-handler function Argument average testNumber testNumber Test Number 245 Day Activity: Tuesday day Activity Day Activity: Sunday Print Table day Activity printTable 245 Tuesday (string) Sunday (string) 7. Method Name: dayActivity Parameters: one parameter, day Return value: none Purpose: This function accepts one parameter named day. It will use a switch statement to test if the day is one of several days. It then outputs a phrase based on the day. 7.1. Declare a variable, output using the let keyword. 7.2. Implement a switch structure and switch on the value of the day parameter. Set the value of the output variable based on the following values Day Output value Monday Not again! Wednesday Half way there! Friday Sunday TGIF! Sunday Funday! All Other Days Just another day! 7.3. Log the output to the Console. 8. Method Name: print Table Parameters: none Return value: none Purpose: This method a multiplication table to the console 8.1. Implement a nested loop structure to output the multiplication table of from 1 to 5. Multiply each number from 1 to 5 with numbers from 1 to 5. (See sample output for format). 8.1.1. Log the output to the console in the format "1*2-2" 8.2. Insert linebreaks as appropriate using \n characters! Work on the JavaScript file and define the following methods. 4. Method Name: average Parameters: none Return value: none Purpose: This method should calculate the average of all numbers from 1 to 10 4.1. Declare any variables you need with restricted scope within the method using the let keyword. 4.2. Implement code to calculate the average of all numbers from 10 10 (inclusive). Use a for loop. 4.3. Output the average to the console using the log function. 5. Method Name: isEven Parameters: one parameter, number Return value: boolean Purpose: This function accepts one parameter value and returns a boolean value indicating if the parameter was even or not. 5.1. Declare any variables you need with restricted scope within the method using the let keyword. 5.1.1. Use the remainder operator (%) and the equal value & type comparison operator (===) 5.2. Return true if number is even and return false if number is odd 6. Method Name: testNumber Parameters: one parameter, number Return value: none Purpose: This method receives a number as a parameter value. It should invoke the isEven function to test if number is even or not. It should then log the result to the console. 6.1. Use the isEven function 6.1.1. Invoke the isEven method and pass it number as an argument. 6.1.2. Store the return value in another variable, evenNumber, declared with restricted scope within the method using the let keyword 6.2. Test the evenNumber variable 6.2.1. Based on the value of evenNumber, log to the console whether the number is even or odd. Sample Output - HTML Rendering Average of 1 to 10 Test Number 6 Test Number 245 Day Activity Tuesday Day Activity Sunday Print Table Sample Output - Console О Group sunte messages Sunday: Sunday Funday " Tuesday: Just another day! Contd... Sunday: Sunday Funday! 1-1-1 1-2-2 2-1-2 2 2 12 4-3-12 16 2-3-6 2 4 5-2-10 5-3-15 3+2+6 5-4-20 3-3-9 3-4-12 2.1. Create a new HTML file. Save the file as javascriptbasics.html. 2.2. Add html, head, meta charset, title, and body tags. 2.3. Set the title of the page to "JavaScript Basics" 2.4. Add a script element within the head element of the HTML page. 2.5. Set the source of the script to script.js 2.6. Add a new external JavaScript file and save it as script.js 2.7. Add your name, assignment #, class, and class time as a comment at the top of the both HTML and the JavaScript files. e.g, John Smith, AS, CIS 235, 9 am Work on the HTML file 3. Add button elements to the HTML body 3.1. Create the buttons as seen below in the table. Set the button text as described. 3.2. Add onclick attributes for each of the buttons 3.2.1. Invoke the corresponding JavaScript function as an event handler. 3.2.2. If an argument is listed, pass the argument within the inline function call. Button name Average Of 1 To 10 Test Number 6 onClick event-handler function Argument average testNumber testNumber Test Number 245 Day Activity: Tuesday day Activity Day Activity: Sunday Print Table day Activity printTable 245 Tuesday (string) Sunday (string)
Expert Answer:
Answer rating: 100% (QA)
Here is the JavaScript code for the dayActivity function function dayActivityday let out... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
KCC imposes a 35% mark-up on christmas balls delivered to them for sale. During Christmas season, however, an additional mark-on of 15% on the regular selling price which is Php50 is added on. How...
-
In this problem, you will use your knowledge of the phase plane and stability to analyze a simple model of glycolysis. The glycolysis pathway that first convert glucose into fructose-6-phosphate...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Suppose that Marthas income rises to $42,000 per year, and that she increases her consumption of health care visits by fi ve visits. Using the graphs for Exercise 1, draw the new equilibrium. What is...
-
Arrange the following kinds of electromagnetic radiation in order of increasing wavelength: infrared, green light, red light, radio waves, X-rays, ultraviolet light.
-
MULTIPLE CHOICES 1. The typical American citizen prefers to stand approximately 18-36 inches away from a person with whom he/she is having a conversation. This is an example of: a. Selective...
-
Continuation of El 1 -28: compute overhead variances (Learning Objective 5) Fresh-Cut actually processed 180,000 cases of frozen organic vegetables during the year and incurred $840,000 of...
-
Merck & Co., Inc. and Johnson & Johnson are two leading producers of healthcare products. Each has considerable assets, and each expends considerable funds each year toward the development of new...
-
Please two attachments. Less than 20 questions. I need in 30 mins. Bonus for who can deliver on time. All multiple choice. I will check answers against answer key The current price of Houston Tennis...
-
Sebastian Incorporated had the following balances at the beginning of November. SEBASTIAN INCORPORATED Trial Balance November 1 Accounts Debits Credits Cash $1,200 Accounts Receivable 400 Supplies...
-
Company X is considered to purchase another company. the company has 3 funding options: 1. To received bank credit 2. issued debentures for 25 years, the payments will start in the sixth year 3....
-
Write detailed steps which use insertion sort algorithm to sort a 7-element integer array [35,42,7,15,36,10,82]. See the following example for the expected detailed steps: i=1 i = 2 i = 3 i = 4 i = 5...
-
Given that the hot thermal reservoir temperature is 250 C and the cold thermal reservoir temperature is 20 C, determine if each of the following 3 proposed heat engines (with operating parameters as...
-
A) Independent set is a set of vertices such that any two vertices in the set do not have a direct edge between them. Maximal independent set is an independent set having highest number of vertices....
-
There are 1,000 trolls in he stock, and 1,500 are due in from orders that were placed previously. The company sells Trolls at the rate of 100 per day and finds that it takes an average of 20 days for...
-
The following T-accounts for the Fitzpatrick Company represent April activity. Required: Compute the missing amounts Indicated by the letters (a) through (1) Materials Inventory Work-in-Process...
-
Prove the formula for (d/dx)(cos-1x) by the same method as for (d/dx)(sin-1x).
-
a. For each of the reactions in parts (a), (b), and (c), suggest a mechanism and apply the PSSH to learn if the mechanism is consistent with the rate law. b. The gas-phase homogeneous oxidation of...
-
The equations describing diffusion and reaction in porous catalysts also can be used to derive rates of tissue growth and have been studied by Professor Kristi Anseth and her students at the...
-
Go to the LearnChemE screencast link for Chapter 15 (http://www.learncheme.com/screencasts/kinetics-reactor-design). View the two screencasts: (1) Diffusion and Reaction in a Cylindrical Porous...
-
A lumber distributor is loading pallets onto trucks with the intention of using the fewest trucks possible to send a shipment. The distributor loads the pallets with the greatest length that will fit...
-
A traveler wants to visit five cities by airplane. The traveler lists all the possible orders in which the cities can be visited then calculates the best airfare for each itinerary and selects the...
-
Graph 17, vertex \(a\) List all the distinct Hamilton cycles beginning at the given vertex in the given graph. Indicate which pairs of Hamilton cycles are reverses of each other. 9.3 1.5 13.3 5.2 8.7...
Study smarter with the SolutionInn App