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
-
A process sampled 20 times with a sample of size 8 resulted in x-bar = 28.5 and R-bar = 1.6. Compute the upper and lower control limits for the and R charts for this process.
-
Maddox, Inc., experienced the following events in 2010, in its first year of operation. 1. Received $20,000 cash from the issue of common stock. 2. Performed services on account for $40,000. 3. Paid...
-
In this chapter we have touched on several important developments in sustainability reporting. Describe any recent developments by visiting the following websites. GRI, www.globalreporting.org ...
-
The Zwatch Company manufactures trendy, high-quality moderately priced watches. As Zwatchs senior financial analyst, you are asked to recommend a method of inventory costing. The CEO will use your...
-
1.Discuss the rationale and significance of the Security Market Line (SML) as a representation of the valuation of risky securities. 2.Outline five of the positive characteristics that are...
-
You send daily emails about a variety of topics for a shoe store. Your open rates are low, but sale announcements perform best. Which two marketing actions would most likely increase open rates?...
-
f(x) = 8x4+3x Find f(-x) =
-
On a decision tree, once the tree has been drawn and the payoffs and probabilities have been placed on the tree, the analysis (computing EMVs and selecting the best alternative) a. working backward...
-
What are the purposes of regression analysis? How does it help businesses?
-
Qualitative factors a. are less important than quantitative factors. b. are difficult or impossible to quantify. c. were first developed by Frederick W. Taylor. d. all of the above.
-
The efficiency of sample information a. is the EVSI/(maximum EMV without SI) expressed as a percentage. b. is the EVPI/EVSI expressed as a percentage. c. would be 100% if the sample information were...
-
What are moving averages used for? Provide an example.
-
Below are Infographics from the Congressional Budget Office showing Mandatory Spending and Discretionary Spending for FY2022. Examine the types of Mandatory and Discretionary Spending and their...
-
What are the six activities involved in the physical supply/distribution system?
-
In Fig. 1130, there is no explicit invariant that states that a Transaction cannot be linked to movements that are linked to the same account, because the structure of the model already demands is....
-
Apply the Account/Transaction pattern to the parallel financial transactions of the example shown in Figs. 1131 to 1135. As the bills may be paid forward, it may be necessary to use memo entries....
-
Look at Fig. 1119 and create a new discount strategy that gives a percentage of discount for sales with more than a certain number of products. Order | < > < > +nr: Natural = < > +date: Date...
Study smarter with the SolutionInn App