Sheep yurt sizing

Tags
Challenge
No

Since worm farming isn't profitable, Paula is getting into the yurting biz. There's a big demand for sheep yurts in Mongolia, Manitoba, and other M places.

Paula sells four models, and can make custom yurts, too. Here are the yurts:

Model Area
Yurtlet 25 sq meters
Rambler 64 sq meters
Homesteader 100 sq meters
X2000 Industrial 200 sq meters
Custom build More than 200 sq meters

Here are the areas one sheep needs at minimum:

Size Area
Big 1.15 sq meters
Medium 0.83 sq meters
Small 0.67 sq meters

When you put sheep into a yurt, you can pack them in three shapes.

  • Rectangular is the most efficient.
  • Circular is less efficient, requiring an extra 20%. So, a herd needing 100 sq meters when packed in a rectangle would need 120 sq meters when packed in a circle.
  • Triangular is the least efficient, requiring an extra 50% more than rectangular.

Write a program to help estimate customers' yurtal needs, based on the sizes of their sheep herds and their packing preference. Use this workbook to start. It opens like this:

Start

Users enter the number of big, medium, and small sheep they have, as well as the packing shape they want to use in their yurts. They click the button and, if there are no input errors, get the area needed, and the model needed. If they have a total of 35 or more sheep, they get a warning.

Here's how errors are reported:

Errors

Input requirements:

  • Data in the number fields must be numeric, and zero or more. Use the error messages shown. Error messages should be red.
  • The packing shape must be C, R, or T. However, allow users to enter lowercase, and to have spaces before and after the letter. So, an input of " c " is valid.

Clear the errors and output each time the program runs. Report all relevant errors when the user runs the program. Don't just report one error at a time.

Here are some output samples:

Output

Output

Notice the warning when there are 35 or more sheep.

Output

Upload your solution to this site. The usual programming standards apply.

Where referenced