Hi Everyone,
I am stuck on a query…I will show what I have so far.
<SCRIPT LANGUAGE = “JavaScript”>
//names of couples stored in array
var contestantNamesArray = [‘Tom and Nazia’, ‘Pat and Dan’, ‘Sandra and Kofi’, ‘Ian and Adele’, ‘Paul and Costas’];
//points awarded by judges and audience stored in arrays
var judgesPointsArray = [2,1,5,4,3];
var audiencePointsArray = [4,5,2,3,1];
//Add code to declare a new array to store the combined points for each couple
var combinedPointsArray = [‘contestantNamesArray’ + ‘judgesPointsArray’] I dont think the part I have written here is correct! I need this section or array to combine and store the points for each couple.
I also need to add code which loops through the couples and adds the points from the judges to the points from the audience, storing the result at the corresponding location in combinedPointsArray.
And lasly add code to find and write out the maximum value that is found in combinedPointsArray.
//Add code to calculate the combined points for each couple and store it in the combined points array
//Add code to find and output the maximum value in the combined points array
//Add code that will
// – write out a heading for the list of couples scoring the maximum
// – write out the names of all the couples with the maximum number of combined points
// keeping count of how many they are
// – at the end, write out whether a dance-off is required or not, depending on how many couples scored the maximum
</SCRIPT>
I would appreciate some help if possible and explain to me how it was acheive and where I had gone wrong?