Computers and Technology
02.08.2020 02:33
206
420
10
Solved by an expert

Duke and North Carolina have a famous basketball rivalry dating back to 1920. The

Duke and North Carolina have a famous basketball rivalry dating back to 1920. The number of points each team has scored in head-to-head competition over five years is provided in the dukeScores and ncScores arrays. Ex: North Carolina won the first game 76-72 since dukeScores[0] is 72 and ncScores[0] is 76. Write a for loop that examines the dukeScores and ncScores arrays and places "D" in the winningTeam array if Duke won or "N" if North Carolina won, for every game. Ex: winningTeam[0] should be "N" because North Carolina won 76-72, and winningTeam[1] should be "D" because Duke won 74-73. Display the contents of the winningTeam array using a for-of loop. Write a forEach() loop that examines the winningTeam array and determines the longest streak of Duke wins. Display the longest streak to the console, which should be 4. To determine the longest streak, use two variables initialized to 0: streak and longestStreak. Loop through the winningTeam array. Every time a "D" appears, increment streak and then update longestStreak if streak > longestStreak. When an "N" is encountered, reset streak back to 0. When the loop terminates, longestStreak will contain the longest streak.
Show Answers
princess42044
princess42044
4,6(36 marks)

yes when rating ads you should only consider your personal feelings on the ad

Popular Questions about the subject: Computers and Technology

Write a program to print even numbers from 1 to 20...
Computers and Technology
04.05.2020 06:02
PLEASE HELP WILL GIVE BRAINLIEST...
Computers and Technology
30.07.2022 03:23
Select all steps in the list below that should be completed when...
Computers and Technology
22.01.2022 13:07
PLEASE HELP WILL GIVE BRAINLIEST AND POINTS...
Computers and Technology
03.03.2020 07:02
What is the output of the...
Computers and Technology
23.09.2020 11:09
A pair of number cubes is used in a game of chance Each number...
Computers and Technology
09.10.2021 15:50
What are the different technologies used to connect millions of...
Computers and Technology
24.06.2023 21:02

New questions by subject

What is the range of the function? a. 1,2,3,4 b. 2,4,9,16 c. 1,2...
Mathematics
18.01.2020 08:50
What are the most prominent achievements of Bahrain in a. Economic...
History
06.02.2022 04:51
whould you kiss your girlfriend or marry or divorce its a game...
Social Studies
21.07.2021 17:58
Just help me pls :)....
Biology
24.09.2020 16:04
#
#
#
#
# #

We expand our knowledge with many expert answers