Favorite leaf

Tags
Challenge
No

Some goats have taken a taste test, saying how much they like three different leafs. Download a start worksheet that has the data.

It looks like this:

Data

When the user clicks on the button, the program asks for a record number, like this:

Ask for record

It grabs that record, and shows the name of the goat, and it's fave leaf:

Output

Notice that the output is on two separate lines.

Validate the record number the user types. It should be number that's one or more, but not greater than the number of records. For example, if someone typed...

Invalid input: non-numeric

... they would see...

Error message for non-numeric input

If they typed a number what was out of range...

Record number too high

... they would see...

Output when record number is too high

Write the code so that the number of records could change, as more data is gathered. That is, don't hard-wire your code so that it only works for 50 goats. So, if data for 20 more goats was added, your program would accept record numbers up to 70, without any of your code changing.

Here's another output example, showing what happens when a goat likes two leaves equally, like record 4:

Likes two leaves equally

Here are the output possibilities.

Sitch Message
A, B, and C are equal Likes all types equally
A is highest Type A
B is highest Type B
C is highest Type C
A = B, and both are higher than C A and B are equal faves
A = C, and both are higher than B A and C are equal faves
B = C, and both are higher than A B and C are equal faves

Upload your workbook. The usual coding standards apply.

Attachments
Where referenced