Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are two gymnastics teams, Dolphins and Koalas. Each team competes 3 times, and then the average of the 3 scores is calculated ( so
There are two gymnastics teams, Dolphins and Koalas. Each team competes times, and then the average of the scores is calculated so one average score per team
A team only wins if it has at least double the average score of the other team. Otherwise, no team wins!
Create an arrow function 'calcAverage' to calculate the average of scores
Use the function to calculate the average for both team.
Create a function 'checkWinner' that takes the average score of each team as parameters avgDolhins and 'avgKoalas' and then logs the winner to the console, together with the victory points, according to the rule above.
Example: "Koalas win vs
Use the 'checkWinner' function to determine the winner for both Data and Data
Ignore draws this time
Test data:
Data : Dolphins score and Koalas score and
Data : Dolphins score and Koalas score and
Hints:
To calculate average of values, add them all together and divide by
To check if number is at least double number check for
Apply this to the team's average scores
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started