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.
-
If Japan has low inflation and Mexico has high inflation, what will happen to the exchange rate between the Japanese yen and the Mexican peso?
-
Find the limit, if it exists, or show that the limit does not exist. x*y + xy (, ) (2, - 1) 2 2 lim y
-
Which is of the following is accurate concerning the engagement partner and, as applicable, other engagement team members performing supervisory activities? (a) Inform engagement team members of...
-
Johnson Enterprises uses a computer to handle its sales invoices. Lately, business has been so good that it takes an extra 3 hours per night, plus every third Saturday, to keep up with the volume of...
-
Sally Hamilton has performed well as the chief financial officer of the Maxtech Computer Company and has earned a bonus. She has a choice among the following three bonus plans: (FV of $1, PV of $1,...
-
In the FRED database, find data on nominal gross domestic product (a measure of total output), nominal exports, nominal imports, the Federal governments current receipts, and Federal government...
-
A group of like cells group together to form: a- organelles. b- Tissues c -organs d -system
-
Which of the following is necessary for fraud to occur? a. Perceived pressure b. Perceived opportunity C. Rationalization d. All three are necessary.
-
How you may use computers for litigation support?
-
Separation of duties refers to separating all of these functions except which of the following? a. Authorizing transactions b. Keeping accounting records C. Hiring personnel d. Maintaining custody of...
-
What discovery devices you may use to obtain facts?
-
Communication between spouses to the other during a valid marriage is privileged. Just as with hearsay, however, there are notable exceptions. Investigate the California Evidence Code 980-987 and...
-
Using multiple department factory overhead rates instead of a single plantwide factory overhead rate Oa. applies overhead costs to all departments equally Ob. results in distorted product costs Oc...
-
We all experience emotions, but some people disguise their true feelings better than others. Do you think this is a helpful or harmful thing to do? Under what conditions do you think it would be most...
-
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?
-
List the economic, social, and personal factors that influence a decision to buy an article of clothing.
-
You recently received a letter offering a four-day vacation trip to Hawaii for only \($350\). The price includes transportation, a hotel room, and meals. To reserve a space, you must send \($175\)....
-
Write a brief paragraph describing a product or service with which you were dissatisfied, and explain what the problem was. Did you complain? If so, what specific steps did you take, and what was the...
Study smarter with the SolutionInn App