المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : لخبراء php فقط لو سمحتم


مبرمج
04-03-2009, 09:46 AM
<div>واجب جامعه العربية المفتوحة طالبين من الطلاب حل هالواجبات انا حليت قسم منه

بس حابب اتاكد من الاجوبه الاخوه اذا ممكن
<div style="margin:20px; margin-top:5px"> رمز Code:

(iii) Make a copy of the file M150_TMA03_2007J_Q2(ii).html and rename it M150_TMA03_2007J_Q2(iii).html. Amend this file so that the program allows the customer to order some products. The program should take the user through the following process:
1- the customer is prompted to enter how many different products they want to purchase (you can assume the customer will input a whole number);
2- For each product, the customer is then prompted to
• enter the item number from the column headed Item in Figure 2, (e.g. they would enter 3 to choose product n-87-012)
• enter how many units of that product they require (e.g. 6 Headbanger hi-fis).
3- Step 2 is then repeated until the number of products the user chose in Step 1 is reached.
When the ordering process is complete, the program prints out the order.
You can assume that the customer will always enter valid product numbers and will never duplicate orders for the same product (e.g. order, say, iPods twice).
Store the details of the customer’s order in two parallel arrays, the first storing the index number of the products the customer has chosen, the second storing the quantities of each product. Thus, if the customer wants to buy three different products, then each array will contain three elements. So, for example, for the order illustrated in Figure 2, the two arrays would contain values as follows
orderProductArray [1, 3, 5]
orderQuantityArray [2, 1, 3]
Section 2.6 of Unit 8, pp. 18–21 tells you how to set up an array and add values to it.
The final part of the output from your program should resemble Figure 3. (Again, don’t waste time trying to get everything aligned.) Here is your order il-77


Code--------Product----------------------------Number---------Price Each
==================================================
k-246-07 -- Apple - iPod (second-hand) ----- 2 ----------------- 50
n-87-012 --Headbanger mini hi-fi 20W ------ 1 ---------------- 25
t-99-002 --The PushmiPulu lawnmower ----- 3 ---------------- 70









Figure 3 Example customer order
Test your program with the password onlyme and the three product numbers for the products shown in Figure 3.
Insert a copy of your JavaScript code into your solution document followed by a screenshot of the browser window showing the result of your test. [12]



a=window.prompt('How many different kind of products do you want to purchase?');

a=parseFloat(a);

product=new Array(a);

quantity=new Array(a);


for(i=0;i