Answer to Question #3250 in AJAX | JavaScript | HTML | PHP for lee

Question #3250
Hi I have been asked to answer the below and i just cant get my head around it as ive only just started javascript/arrays<br><br>If anyone could help me id be greatly thankful<br>I need to product the table output as per below<br>web page header: election results<br><br>header or table: Fantanswill Historical society by-election results<br><br>Mr R Green...33<br>Ms O brown...51<br>Ms Y Black....43<br>Mr G White...22<br>Ms B Grey....61<br>Ms I Blue.....51<br>Mr V Pink....47<br>Ms B Grey .... Is hereby declared elected<br><br>The below is he script i need to amend to make the above table of output.<br>Can anyone please help me as im now puling my hair out and cant get it to work<br>thanks in advance xx<br><br><title><br>Election Results<br></title><br><link rel="stylesheet" type="text/css" href="tma03.css"><br><script language="JavaScript"><br>& /* <br>& *& M150 TMA03 2011B Q3.<br>& *& Program to report the results of an election.<br>& */<br><br>// SAMPLE DATA <br>// candidates<br>var candidateArray = <br>['Mr R Green...', 'Ms O Brown...', 'Ms Y Black...', 'Mr G White...', 'Ms B Grey....','Ms I Blue....', 'Mr V Pink....'];<br>// online votes<br>var onlineVotesArray = [21,47,23,11,56,47,30];<br>// paper votes<br>var paperVotesArray = [12,4,20,11,5,4,17];<br><br>// SECOND& DATA& SET<br>// TODO part (v) comment out the SAMPLE DATA above and uncomment the second set below by removing the /* and */<br>/*<br>var candidateArray = <br>['Ms A& Brown .......', 'Mr C Smith .......', 'Ms F Patel .......', 'Ms B Jones .......', 'Mr E Williams...', 'Mr D Johnson ....', 'Ms G Taylor'];<br>// online votes<br>var onlineVotesArray = [41,37,43,11,59,21,36];<br>// paper votes<br>var paperVotesArray = [22,3,15,11,7,1,18];<br>*/<br><br>// TODO part (i)<br>// total votes --& to be initialised below<br>var totalVotesArray;<br>// Add code to<br>//& & & -- initialise totalVotesArray with a new empty array of the same size as candidateArray<br>//& & & --& use a loop to add the online and paper votes for each candidate and store the result at <br>//& & & & & & & the corresponding position in the total votes array.<br><br>// TODO part (ii)<br>// Add code to display two lines of heading, then a blank line,<br>// then a list of candidates with the total votes cast for each.<br>& <br>// Variable to store the index at which the maximum total vote occurs.<br>var maximumTotalVoteIndex;<br>// TODO part (iii)(b)<br>// Add code to determine the index at which the maximum total vote occurs.<br>& <br>//TODO part (iv)<br>//Add code to report which candidate has been elected.<br></script>
Expert's answer
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog