Answered step by step
Verified Expert Solution
Link Copied!

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 3 times, and then the average of the 3 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 3 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 (30 vs.13)"
Use the 'checkWinner' function to determine the winner for both Data 1 and Data 2.
Ignore draws this time
Test data:
Data 1: Dolphins score 44,23 and 71. Koalas score 65,54 and 49
Data 2: Dolphins score 85,54 and 41. Koalas score 23,34 and 27
Hints:
To calculate average of 3 values, add them all together and divide by 3
To check if number A is at least double number B, check for A2**B.
Apply this to the team's average scores
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

Students also viewed these Databases questions

Question

4 How can employee involvement be achieved?

Answered: 1 week ago