Paintball Halloween

It's Halloween.

You hate Halloween.

You decide to shoot unpleasant paintballs at people who enter your front gate. You have two laser-targeted paintball turrets by your door. You call them Stinker and Red. Stinker shoots balls filled with liquid artificial skunk stench. Red shoots balls filled with artificial blood.

You decide every adult who enters your gate will get three skunkballs, and five bloodballs. Every teenage will get four skunkballs, and three bloodballs. Every tween will get one skunkball, and one bloodball. Younger kids won't be shot at. Their turn will come.

You use high-quality paintballs. Skunkballs cost you $0.25 each, and bloodballs $0.07 each.

Write a program to compute the number of each ball type you'll need and their total cost, given a number of adults, teens, and tweens. Here's a screenshot:


Round the cost to the neatest cent. It's OK to leave off the last digit if it's zero, as in the sample output above. Check the rounding numbers hint; it might be useful.

All inputs should be numeric, and not less than zero. Your program should show an error message and stop when there's an error. For example:



Your program can stop immediately when it detects an error, or show all applicable error messages and then stop. Your choice.

You must use subroutines. Use three at least: input, processing, and output. You may use more if you want.

The usual coding standards apply.

Upload your solution.

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

Referenced in: