Question 2 (a) (i) Write a JavaScript code fragment that obtains five strings from input fields,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 2 (a) (i) Write a JavaScript code fragment that obtains five strings from input fields, stores them in an array, uses the sort function to sort it into lexicographic order and displays the sorted array in a presentation tag on the HTML page from which the script was invoked. All interaction with the document object model should be done using JQuery. You should assume that the input fields have id attributes idl, id2, id3, id4 and id5 and the presentation tag has the id attribute sorted. (ii) Explain the changes that would need to be made to the above code if the inputs [4%] were numbers and the sorting was to use numerical order. (b) A website for an online shop has the following Java classes to represent products and shopping baskets. (Not all class methods are shown.) public class Shopping Basket { Map<Product, Integer> items; int getTotalCost (); // returns total in pence } //values are quantities public class Product implements Comparable<Product> { int price; // in pence } String name; String id; [6%] Write a JSP fragment that will display the contents of a shopping basket in tabular form along with the total cost in pounds and pence. You should assume that a reference to the basket is held in a variable called basket of type ShoppingBasket. [13%] Question 2 (a) (i) Write a JavaScript code fragment that obtains five strings from input fields, stores them in an array, uses the sort function to sort it into lexicographic order and displays the sorted array in a presentation tag on the HTML page from which the script was invoked. All interaction with the document object model should be done using JQuery. You should assume that the input fields have id attributes idl, id2, id3, id4 and id5 and the presentation tag has the id attribute sorted. (ii) Explain the changes that would need to be made to the above code if the inputs [4%] were numbers and the sorting was to use numerical order. (b) A website for an online shop has the following Java classes to represent products and shopping baskets. (Not all class methods are shown.) public class Shopping Basket { Map<Product, Integer> items; int getTotalCost (); // returns total in pence } //values are quantities public class Product implements Comparable<Product> { int price; // in pence } String name; String id; [6%] Write a JSP fragment that will display the contents of a shopping basket in tabular form along with the total cost in pounds and pence. You should assume that a reference to the basket is held in a variable called basket of type ShoppingBasket. [13%]
Expert Answer:
Answer rating: 100% (QA)
OUTPUT Num1 22 Num2 43 Num3 54 Num4 25 Num5 76 Sort N... View the full answer
Related Book For
Principles Of Managerial Finance
ISBN: 978-0136119463
13th Edition
Authors: Lawrence J. Gitman, Chad J. Zutter
Posted Date:
Students also viewed these accounting questions
-
Given the function below about Xs: f(x)=x at x +9 1.1.1. What makes this function non-linear? (3) 1.1.2. Find the linear approximation of the function
-
Walmart has made several changes in its data communication systems to improve its suppliers access to sales and inventory data. For example, the company added a customized Web site for its suppliers,...
-
Question 6 The government of Jonovia seizes all assets of Refresh, a world-famous, soft-drink brand in Jonovia, and offers compensation to the company. This action by the government of Jonovia is an...
-
State the density property of a barometer liquid and explain its effects. Explain in detailed.
-
Why is a two-stage instruction pipeline unlikely to cut the instruction cycle time in half, compared with the use of no pipeline?
-
A circumferential fin of rectangular profile is constructed of stainless steel with k = 43 W/m C and a thickness of 1.0 mm. The fin is installed on a tube having a diameter of 3.0 cm and the outer...
-
Explain the three types of visibility for package elements: public, private, and protected.
-
Do the IFRS and GAAP conceptual frameworks differ in terms of the objective of financial reporting? Explain.
-
What is the difference in revenue and expense recognition between the cash basis of accounting and the accrual basis of accounting?
-
When faced with a clearly erroneous precedent, my rule is simple, writes Supreme Court Justice Clarence Thomas. We should not follow it. How do these words offer a cautionary tale for managers...
-
Consider a bioinstrumentation amplifier interfacing with electrodes to measure a biopotential signal originating from the body. The voltage signal picked up by the electrodes, placed in direct...
-
Does simply following laws and policies make the employees of criminal justice organizations moral? When employees follow rules, policies, and procedures, are there fewer or greater economic impacts...
-
Based on the Ted Talk in the Nudge lecture, what is hedonic decline? To promote healthy eating, we can provide a menu with information about calories and fat OR a sensory menu that describes all the...
-
Think about a time where you had multiple deadlines. Discuss how the scheduling and sequencing methods discussed in this topic could have helped for your case. Do you think quality control and...
-
What is the Line/15 Min City? Are there any ethical concerns? What do you think of the concept? Would you move there? How would you make money in this type of city? How does this city impact...
-
Did you enjoy the documentary film on Dr. Barnes and his museum? What struck you the most about the film? And why? To what extent do you believe that visual arts such as paintings, sculpture, and...
-
How are digital certificates used to verify a user's identity?
-
What is taxable income, and what is the formula for determining taxable income?
-
How is the prime rate of interest relevant to the cost of short-term bank borrowing? What is a floating-rate loan?
-
Are secured short-term loans viewed as more risky or less risky than unsecured short-term loans? Why?
-
How do the constant-growth valuation model and capital asset pricing model methods for finding the cost of common stock differ?
-
The chief goal of the private sector is effciency.Why? The primary focus of the public sector is equity. Why? It is quite possible to be highly effcient yet ineffective. It is also possible to be...
-
Why is healthcare reform such a contentious issue in the United States? Why have public and private efforts been unsuccessful in fully addressing the challenge of affordable health care? What role(s)...
-
Drawing on economic theory, what kinds of market failure underlie the worlds most pressing problems? Examine three examples: hunger, groundwater contamination, and literacy.
Study smarter with the SolutionInn App