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
-
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...
-
Companies such as BMW, Audi, Mercedes, and Tiffany are thriving these days because they are expanding their luxury brands into more affordable product lines, thus allowing them to offer their premium...
-
Why do people voluntarily choose to specialize and trade?
-
Conventional financial accounting suggests that environmental permits should be measured by using the historical cost principle. One alternative is that current market prices should be used instead....
-
The American demand and supply curves for labor cross at a wage rate of $25 per hour. However, American firms can hire as many foreign workers as they want to at a wage of $15 per hour. (Assume that...
-
[The following information applies to the questions displayed below.] Project Y requires a $343,500 investment for new machinery with a four-year life and no salvage value. The project yields the...
-
Saint Leo is developing a plan to promote their new Center in your hometown. The University's marketing director wants to use a varied and balanced approach to IMC. For each of the five IMC types...
-
Choose all the answers that are correct. There can be more than one. Experiments on gender and leadership have found that: when people picture a leader, they usually picture a man. when men on a...
-
What was the culture of PHS clinical decision making before the advent of its LMR and CPOE systems and how has the enterprise - wide rollout of LMR and CPOE changed core health care delivery business...
-
A meteorologist is 3.8 km from a thunderstorm when she sees a lightning bolt emerge from the storm. In how many seconds will she hear thunder after seeing the lightning? Assume air temperatur = 20C...
-
Will the "government" or the "free market" be better able to manage the cost of healthcare?
-
Challenger Factory produces two similar products - regular widgets and deluxe widgets. The total plant overhead budget is $537,800 with 334,900 estimated direct labor hours. It is further estimated...
-
What role does trust play in fostering fruitful collaboration among stakeholders in strategic alliances and partnerships? Explain
-
A pendulum is held at an angle of 30 as shown in figure 1 and then released. The length from the top of the string to the centre of the spherical pendulum is 0.25 m. Calculate the maximum velocity of...
-
A woman at a point A on the shore of a circular lake with radius 2 mi wants to arrive at the point C diametrically opposite on the other side of the lake in the shortest possible A time. She can walk...
-
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...
-
Munro Limited is a small company with two divisions. One division trades in specialized equipment for walkers and mountaineers, and the other sells artists materials. The company has acquired rights...
-
You are undertaking the fieldwork for the audit of the financial statements of CAREFREE Limited for the year ended 31 December 2020. CAREFREE owns and operates a network of six private nursing homes,...
-
You are auditing a manufacturing company and have drafted a management letter that contains reference to matters to increase the efficiency of company systems and the general profitability of the...
Study smarter with the SolutionInn App