5

Click here to load reader

M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

Embed Size (px)

Citation preview

Page 1: M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

M150B_TMA03_Spring _2009_Q3.html<!-- saved from url=(0022)http://internet.e-mail --><HTML>

<HEAD><TITLE>Spring 2009 M150 TMAO3 Question 3 Solution</TITLE>

<SCRIPT language="JavaScript"

type="text/javascript">

// These are arrays containing product data

var productDescriptions = ['Superslurry electric blender', 'Apple - iPod (second-hand)', 'CoziNap nylon duvet tog 2', 'Headbanger mini hi-fi 20W', 'MagiBoot

shoe cleaning kit', 'The PushmiPulu lawnmower'];

var productPrices = [45, 50, 15, 25, 75, 70];

var productStock = [200, 0, 2, 500, 500, 15];

var receivedLevels = [50, 10, 150, 500, 50, 100];

document.write ( "<br> ");

// Write the function showStockLevels() herefunction showStockLevels(){//formname.textnameofMainStock.value = productStock[ ];

administrator.ssMainStock.value= productStock[0];administrator.aiMainStock.value= productStock[1];administrator.cnMainStock.value= productStock[2];administrator.hbMainStock.value= productStock[3];administrator.mbMainStock.value= productStock[4];administrator.ppMainStock.value= productStock[5];

// formname.textnameofReceivedStock.value = receivedLevels[ ];

administrator.ssReceivedStock.value= receivedLevels[0];administrator.aiReceivedStock.value= receivedLevels[1];administrator.cnReceivedStock.value= receivedLevels[2];administrator.hbReceivedStock.value= receivedLevels[3];administrator.mbReceivedStock.value= receivedLevels[4];administrator.ppReceivedStock.value= receivedLevels[5];}

// Write the function addAllReceivedItems() herefunction addAllReceivedItems()

Solved by Ms. Malak El-Amir - Page 1

Page 2: M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

M150B_TMA03_Spring _2009_Q3.html{

// formname.textnameofMainStock.value = productStock[ ] + receivedLevels[ ];

administrator.ssMainStock.value= productStock[0] + receivedLevels[0];administrator.aiMainStock.value= productStock[1] +receivedLevels[1];administrator.cnMainStock.value= productStock[2] +receivedLevels[2];administrator.hbMainStock.value= productStock[3] + receivedLevels[3];administrator.mbMainStock.value= productStock[4] +receivedLevels[4];administrator.ppMainStock.value= productStock[5] + receivedLevels[5];

// formname.textnameofReceivedStock.value = 0;

administrator.ssReceivedStock.value=0administrator.aiReceivedStock.value= 0;administrator.cnReceivedStock.value= 0;administrator.hbReceivedStock.value= 0;administrator.mbReceivedStock.value= 0;administrator.ppReceivedStock.value= 0;}

// Write the function calculateTotals() herefunction calculateTotals(){var totalMainStockItems = 0;var totalReceivedStockItems = 0;var totalNumberOfStockitems = 0;var totalValueOfStock = 0;

var taxOnMain = 0;var taxOnReceived = 0;var totalTaxPayable = 0;

for (var i=0; i < productPrices.length; i=i+1){

totalMainStockItems = totalMainStockItems + productStock[i];totalReceivedStockItems = totalReceivedStockItems + receivedLevels[i];

totalValueOfStock = totalValueOfStock + (productStock[i] + receivedLevels[i] ) * productPrices[i];

taxOnMain = taxOnMain + (0.08 * productStock [i] * productPrices [i]);

taxOnReceived= taxOnReceived + (.06 * receivedLevels [i] * productPrices [i]);

}

totalNumberOfStockitems = totalMainStockItems + totalReceivedStockItems;

Solved by Ms. Malak El-Amir - Page 2

Page 3: M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

M150B_TMA03_Spring _2009_Q3.htmltotalTaxPayable = taxOnMain + taxOnReceived

statistics.mainStock.value = totalMainStockItemsstatistics.receivedStock.value = totalReceivedStockItemsstatistics.allStock.value = totalNumberOfStockitemsstatistics.allStockValue.value = totalValueOfStockstatistics.allTax.value = totalTaxPayable;}

</SCRIPT></HEAD><BODY><h1> M150B- TMA03 Spring 2009 Question3 Solution, <br>Solved by Ms. Malak El-Amir, M150B Tutor AOU - Jeddah Branch </h1><FORM NAME = "administrator"><BR>SOFA SPEND plc. CURRENT STOCK LEVELS<BR><BR>Superslurry electric blenders <BR> Current stock<BR><INPUT TYPE = "text" NAME = "ssMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "ssReceivedStock"

VALUE = ""><BR><BR>Apple iPods (second hand) <BR> Current stock<BR><INPUT TYPE = "text" NAME = "aiMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "aiReceivedStock"

VALUE = ""><BR><BR>CoziNap duvets<BR> Current stock<BR><INPUT TYPE = "text" NAME = "cnMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "cnReceivedStock"

VALUE = ""><BR><BR>Headbanger hi-fi<BR> Current stock<BR><INPUT TYPE = "text"

Solved by Ms. Malak El-Amir - Page 3

Page 4: M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

M150B_TMA03_Spring _2009_Q3.html NAME = "hbMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "hbReceivedStock"

VALUE = ""><BR><BR>Magiboot cleaning kits<BR> Current stock<BR><INPUT TYPE = "text" NAME = "mbMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "mbReceivedStock"

VALUE = ""><BR><BR>PushmiPulu lawnmowers<BR> Current stock<BR><INPUT TYPE = "text" NAME = "ppMainStock"

VALUE = "" >Received:<INPUT TYPE = "text" NAME = "ppReceivedStock"

VALUE = ""><BR><BR><INPUT TYPE = "button" VALUE = "Show all stock holdings"

ONCLICK = "showStockLevels()"><INPUT TYPE = "button" VALUE = "Add receipts to stock"

ONCLICK = "addAllReceivedItems()"><BR><BR>

</FORM>

<FORM NAME = "statistics">Total main stock items<BR> <INPUT NAME = "mainStock" "TYPE = "text" VALUE = '' ><BR>Total received stock items<BR><INPUT NAME = "receivedStock" "TYPE = "text" VALUE = '' ><BR>Total number stock items --- Total value of stock ------- Total tax payable<BR>

Solved by Ms. Malak El-Amir - Page 4

Page 5: M150B TMA03 Spring 2009 Q3.html - Notepad · M150B_TMA03_Spring _2009_Q3.html totalTaxPayable = taxOnMain + taxOnReceived statistics.mainStock.value = totalMainStockItems statistics.receivedStock.value

M150B_TMA03_Spring _2009_Q3.html<INPUT NAME = "allStock" "TYPE = "text" VALUE = '' ><INPUT NAME = "allStockValue" "TYPE = "text" VALUE = '' ><INPUT NAME = "allTax" "TYPE = "text" VALUE = '' ><BR><BR>Press button to calculate .........<INPUT TYPE = "button" VALUE = "Calculate totals"

ONCLICK = "calculateTotals()"></FORM><h1> M150B- TMA03 Spring 2009 Question3 Solution, <br>Solved by Ms. Malak El-Amir, M150B Tutor AOU - Jeddah Branch </h1></BODY>

</HTML>

Solved by Ms. Malak El-Amir - Page 5