Dog happiness

Tags
Challenge
No

The file dog-happiness.csv has data about dog happiness, collected from happiness-recording collars. For each dog, there's the dog's name, its happiness level, and phone number:

  • "Sima",8.12,2486984674
  • "Minnie",8.29,2487307245
  • "Meg",9.98,2482451990

Happiness values should be numbers between 1 to 10. Sometimes the collars malfunction, because of excess drool, so you have to check the data.

Write a program that runs when the user clicks a Run button. The program gets the name of the CSV file from the worksheet. It shows an error if the file name is missing.

Missing file name

The program computes the average happiness and dog count, but only for valid data. That is, invalid happiness values are not included in the average and count.

The program also shows the happiest and saddest dogs. It shows their name, happiness, and phone number. Again, invalid data is excluded.

Here's the output:

Output

If you want to reduce the number of decimal places in the output, check out the rounding tip.

Hint: treat phone numbers as strings.

Upload your workbook. The usual coding standards apply.

Attachments
Where referenced