Write a program to estimate the cost of a goat exploration expedition. You can download a starter workbook. It starts like this:
Users enter the number of goats of different sizes. The values must be numeric, and cannot be less than zero. If there are errors, display error messages all at once, and don't output anything. For example:
Don't forget to erase old error messages, and the output, the next time the program runs.
Estimated days should be a number, at least four. Valid values for terrain are shown in the screen shot. Let users type lowercase if they want, and add extra spaces if they want. Here's another sample screen:
The terrain is OK, since lowercase and extra spaces are allowed.
Here's some output:
For planning purposes, add three extra days in your calculations. Don't change the user's input, though. For example, if the user estimated six days, do your calculations based on nine days, though leave the cell the user typed in (B8) at six.
Large goats need two ration packs per day. Medium goats need one per day, and small goats need half a pack per day.
Ration packs cost $8 each, unless the expedition is going into jungle. Jungle packs cost $10 each.
Goats need one water jug each, unless they're going into the desert. Then they need two each. Water jugs cost $17 each.
Panniers let goats carry supplies. Here's a small goat with a pannier:
Panniers can hold 16 ration packs, or four water jugs. Round up the number of panniers, like this:
- sPanniersCount = Application.RoundUp(sPanniersCount, 0)
Large and medium goats can carry two panniers each. Small goats can carry one.
Panniers cost $42 each.
There are two warnings you should show, if applicable:
- When there are more panniers than the goats can carry. Show: You have more panniers than you can carry.
- Estimated days (the user input) is more than 14. Show: Please check with Tough Toni.
If both warnings are needed, they should be together. For example:
Some more output:
Upload your solution here, not to Moodle. The usual programming standards apply.