Question: Question 2 (a) (i) Write a JavaScript code fragment that obtains five strings from input fields, stores them in an array, uses the sort
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 items; int getTotalCost (); // returns total in pence } //values are quantities public class Product implements Comparable { 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%]
Step by Step Solution
3.47 Rating (180 Votes )
There are 3 Steps involved in it
OUTPUT Num1 22 Num2 43 Num3 54 Num4 25 Num5 76 Sort N... View full answer
Get step-by-step solutions from verified subject matter experts
