Try like this var maximumTotalVoteIndex = 0; var maximumVote=totalVotesArray0; for (var count = 1; count maximumVote) { maximumVote = totalVotesArraycount; maximumTotalVoteIndex = count; } } document. Write("ghest scoring Candidate is "+candidateArraymaximumTotalVoteIndex+"with votes"+maximumVote).
– pmlmedia Jun 28 at 16:58 no since we consider maximumTotalVoteIndex as 0 we have to start the checking from index 1. – mahesh Jun 29 at 4:12.
MaximumTotalVoteIndex = totalVotesArraycount; There is the main problem. TotalVotesArraycount is the number of votes for the count-th person, whereas maximumTotalVoteIndex is the person. So you should keep maximumTotalvoteIndex = count.By the way, count should begins from 0 in your for loop.
Thanks for the explanation - I was looking for an explanation so I know what I was doing wrong. – pmlmedia Jun 28 at 16:45.
Typo on this loop, should be maximumTotalVoteValue) { maximumTotalVoteValue = totalVotesArraycount; } } //find ppl with maximum vote var winners= ; for (var count = 0; count Length === 1) { document. Write(winners0 + " is declared the winner"); } else { document. Write(" Tied: " + winners.
Join(" and ")); } document. Write(", with: " + maximumTotalVoteValue ).
Thanks Alex - I didn't even consider ties! Thank you for your detailed answer – pmlmedia Jun 28 at 16:43.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.