Suggested Solution

Task 1 Task 2 Task 3
Task 1 Task 2 Task 3
Random Name

Task 1

A function, getAverage generates 100 random numbers between 1 and 100.

It displays the average value.

Code this function and call it from a main driving program.

Random Name

Task 2

A kindergarten teacher is teaching animal words to her students. She is trying to explain that words have different lengths.

Implement a function, totalLength, that will allow the teacher to enter 5 different animal names. It will show the length of each word, and at the end, the total length of all of the words.

Test your program with the following words:

catrabbitelephantcrocodilered-lipped batfish

The final total should be 44.

Task 3

A function, sumPairs, generates 10 random numbers in the range 1 to 10.

If each pair of numbers adds up to a number greater than 10, the first number is added to a total.

For example, if the following 10 numbers are generated:

3811348521

then the program will produce a total of 11.

Implement this function.