Skip to main content

Thread: help needed please jaascript - arrays


hi have been asked answer below , cant head around ive started javascript/arrays

if me id thankful

i need product table output 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 blue.....51
mr v pink....47

ms b grey .... hereby declared elected



the below script need amend make above table of output

can please me im puling hair out , cant work
thanks in advance xx

<html>
<head>
<title>
election results
</title>
<link rel="stylesheet" type="text/css" href="tma03.css">
<script language = "javascript">
/*
* m150 tma03 2011b q3.
* program report results of election.
*/

// sample data
// candidates
var candidatearray =
['mr r green...', 'ms o brown...', 'ms y black...', 'mr g white...', 'ms b grey....','ms 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 sample data above , uncomment second set below removing /* , */
/*
var candidatearray =
['ms 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 -- initialised below
var totalvotesarray;
// add code to
// -- initialise totalvotesarray new empty array of same size candidatearray
// -- use loop add online , paper votes each candidate , store result @
// corresponding position in total votes array.


// todo part (ii)
// add code display 2 lines of heading, blank line,
// list of candidates total votes cast each.


// variable store index @ maximum total vote occurs.
var maximumtotalvoteindex;
// todo part (iii)(b)
// add code determine index @ maximum total vote occurs.


//todo part (iv)
//add code report candidate has been elected.


</script>

</head>
<body>
</body>
</html>



Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk help needed please jaascript - arrays


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support