Clown clearance

The sleepy town of Fall's End, Montana, has been invaded by evil aliens! They have turned the townsfolk into lava lamps. There are roughly forty aliens, though the exact number is not known.

Poor research led the aliens to disguise themselves as clowns. They thought they would blend in with the locals.

Hansen has discovered that felines are the only creatures unaffected by the aliens' transmogrifiers. Write an Excel worksheet with some VBA to help him figure out how many leopards, lions, and tigers to hire. You can download a starter worksheet.

Here's what your solution should look like to start with:

Validate the three inputs. They must be numeric, and cannot be less than zero. In addition, leopards cannot be more than six, lions cannot be more than five, and tigers cannot be more than three.

Here are some error messages:

If there are any input errors, show all of the error messages at once. Hint: use the flag pattern.

Clear all output and error messages each time the program runs.

You can use subs for this, but you don't have to.

Compute and output the cost, and the number of clowns eaten. Each leopard $4,000, and will eat two clowns. Each lion costs $8,500, and will eat four clowns. Each tiger costs $12,800, and will eat seven clowns.

Hint: use singles for all numbers. It's just easier that way.

Here is some output:

Hansen has $90,000 in his wallet. If the total cost is more than $90,000, show a message along with the output, like this:

The usual coding standards apply.

Upload your worksheet.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Referenced in: