Write a program using scripted tags and php that will read 3 integer numbers using sub-functions...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
• Write a program using scripted tags and php that will read 3 integer numbers using sub-functions to display them back - numbers entered, find the sum, average, largest number. • Solution – prompt, parselnt (i) Start your script tag with a prompt dialogue that loops 3 times to receive an integer value and stores the number to an array in function input. The function then calls sum(). Code Sample for(let i=0; i<3;) x[i] = parseInt (prompt ("Enter # " , value='add your number here')); loahort says localhost say enter2 umber Cam • Solution - prompt, getByElementld (ii) Sum function calculates the total numbers while output displays the results of the number stored to the array and others. Code Sample function sum (2) { return output (z, total); function output (z, total) { document.getElementByld('c').innerHTML = y + "<br> Sum is + total; The numbers are - 10, 20, 30, Sum is 60 • Solution -php echo (iii) Call the script lines by determining the placement of the <?php ?> tags below e.g. K?php $x = '<seript> input () </seript>'; echo $x; ?> <?php echo şoutput "ch2 id='c style='color:blue'> </h2>": ?> (iv) Use sample as a guide to find the average and largest number. Useful functions - source : https://www.w3schools.com/PHP/php_ref_math.asp • Write a program using scripted tags and php that will read 3 integer numbers using sub-functions to display them back - numbers entered, find the sum, average, largest number. • Solution – prompt, parselnt (i) Start your script tag with a prompt dialogue that loops 3 times to receive an integer value and stores the number to an array in function input. The function then calls sum(). Code Sample for(let i=0; i<3;) x[i] = parseInt (prompt ("Enter # " , value='add your number here')); loahort says localhost say enter2 umber Cam • Solution - prompt, getByElementld (ii) Sum function calculates the total numbers while output displays the results of the number stored to the array and others. Code Sample function sum (2) { return output (z, total); function output (z, total) { document.getElementByld('c').innerHTML = y + "<br> Sum is + total; The numbers are - 10, 20, 30, Sum is 60 • Solution -php echo (iii) Call the script lines by determining the placement of the <?php ?> tags below e.g. K?php $x = '<seript> input () </seript>'; echo $x; ?> <?php echo şoutput "ch2 id='c style='color:blue'> </h2>": ?> (iv) Use sample as a guide to find the average and largest number. Useful functions - source : https://www.w3schools.com/PHP/php_ref_math.asp
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
Show two snippets of PHP code that compare creating a connection to a database in standard PHP and in PDO. Discuss the similarities and differences in the code.Show two snippets of PHP code that...
-
Using the Microsoft Drivers for PHP for SQL Server as an example, briefly describe how to install and enable additional PHP dynamic extension *.dll files to an existing PHP installation.
-
Write the PHP script that collects the data from the form of Exercise 9.11 and writes it to a file. Write, test, and debug (if necessary) PHP scripts for the specifications that above. Data from...
-
Exporting files into binary files is done in O Logical files O Physical backup O Physical full backup O Physical partial backup L
-
The Barden Corporations comparative balance sheets for 2014 and 2013 are presented below .:. The income statement of Barden Corporation for the year ended December 31, 2014, is as follows: .:....
-
The Charlotte Bobcats, a professional basketball team, has been offered the opportunity to purchase the contract of an aging superstar basketball player from another team. The general manager of the...
-
8 horses In horse racing, a trifecta bet is one where the player tries to predict the top three finishers in order. In the following exercises, find the probability of choosing a winning trifecta bet...
-
Review the financial statements and related notes of Starbucks in Appendix A. Required: Answer the following questions pertaining to Starbuckss balance sheet as of September 29, 2013, and related...
-
A professor samples 9 random TCC students and record their commute times. She finds that the average commute time of the 9 students is 13.59 minutes with a standard deviation of 3.5 minutes. She also...
-
A manufacturing services provider of complex optical and electromechanical components seeks to gain efficiency in its jobshop scheduling decision because the current shopfloor operations suffer from...
-
Discuss the influence of behavioral learning theories on the Transfer of Technology (TOT) in agricultural extension?
-
Question: Make your career goals as a registered nurse following the SMART model. Each one of the components of the model must be addressed with specifics: specific, measurable, attainable, relevant,...
-
Business Solutions's second-quarter 2022 fixed budget performance report for its computer furniture operations follows. The $177,300 budgeted expenses include $119,880 in variable expenses for desks...
-
What is the purpose of a GPO ? And how is to manage an integrated Health Network (IHN)?
-
What is the difference between BDI interviewing technique and motivational interviewing?
-
What is the secret sauce to Wendy's dynamite social media strategy, especially on Twitter
-
Exercise 10-12 (Algo) The Evangelical Private School follows FASB standards of accounting and reporting. 1. Cash contributions were received as follows: (a) $977,000 for any purpose desired by the...
-
Modify the counter from Exercise 5.44 such that the counter will either increment by 4 or load a new 32-bit value, D, on each clock edge, depending on a control signal Load. When Load = 1, the...
-
A BMW executive in Germany is trying to decide whether the company should continue to manufacture an engine component or purchase it from Hanover Corporation for 25.56 Euros (EUR) each. Demand for...
-
Lake Superior Electronics Company paid $7 million in cash four years ago to acquire a company that manufactures CD-ROMs. This company operates as a division of Lake Superior and has lost $500,000...
-
Assume that a division of Sony, Inc. makes an electronic component for its speakers. Its manufacturing process for the component is a highly automated part of a just-in-time production system. All...
Study smarter with the SolutionInn App