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

If anyone could help me id be greatly thankful
I need to product the table output as per below
web page header: election results

header or table: Fantanswill Historical society by-election results

Mr R Green...33
Ms O brown...51
Ms Y Black....43
Mr G White...22
Ms B Grey....61
Ms I Blue.....51
Mr V Pink....47
Ms B Grey .... Is hereby declared elected

The below is he script i need to amend to make the above table of output.
Can anyone please help me as im now puling my hair out and cant get it to work
thanks in advance xx

<title>
Election Results
</title>
<link rel="stylesheet" type="text/css" href="tma03.css">
<script language="JavaScript">
& /*
& *& M150 TMA03 2011B Q3.
& *& Program to report the results of an election.
& */

// SAMPLE DATA
// candidates
var candidateArray =
['Mr R Green...', 'Ms O Brown...', 'Ms Y Black...', 'Mr G White...', 'Ms B Grey....','Ms I Blue....', 'Mr V Pink....'];
// online votes
var onlineVotesArray = [21,47,23,11,56,47,30];
// paper votes
var paperVotesArray = [12,4,20,11,5,4,17];

// SECOND& DATA& SET
// TODO part (v) comment out the SAMPLE DATA above and uncomment the second set below by removing the /* and */
/*
var candidateArray =
['Ms A& Brown .......', 'Mr C Smith .......', 'Ms F Patel .......', 'Ms B Jones .......', 'Mr E Williams...', 'Mr D Johnson ....', 'Ms G Taylor'];
// online votes
var onlineVotesArray = [41,37,43,11,59,21,36];
// paper votes
var paperVotesArray = [22,3,15,11,7,1,18];
*/

// TODO part (i)
// total votes --& to be initialised below
var totalVotesArray;
// Add code to
//& & & -- initialise totalVotesArray with a new empty array of the same size as candidateArray
//& & & --& use a loop to add the online and paper votes for each candidate and store the result at
//& & & & & & & the corresponding position in the total votes array.

// TODO part (ii)
// Add code to display two lines of heading, then a blank line,
// then a list of candidates with the total votes cast for each.
&
// Variable to store the index at which the maximum total vote occurs.
var maximumTotalVoteIndex;
// TODO part (iii)(b)
// Add code to determine the index at which the maximum total vote occurs.
&
//TODO part (iv)
//Add code to report which candidate has been elected.
</script>
1
Expert's answer
2011-06-29T11:46:53-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS