Bo Peep is in the yurting biz. There's a big demand for sheep yurts in Mongolia, Manitoba, and other M places.
Bo sells four models, and can make custom yurts, too. Here are the yurts Bo sells:
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 |
---|---|
Small | 0.67 sq meters |
Medium | 0.83 sq meters |
Big | 1.15 sq meters |
So if you had, say, 10 small sheep, 11 medium, and 8 big, you'd need at least 8 × 1.15 + 11 × 0.83 + 10 × 0.67 = 25.03 sq meters.
You also need a ventilator to prevent methane explosions. There are three models: Sipper (low flow), Gulper (medium flow), and Chugger (blast it!). The Sipper is cheap but less effective. If you use one, you'll need to add 22% to the area needed, so there's space around the sheep for the gas. The Gulper is better, but you'll still need to add 12%. The Chugger is... well, it sucks really well. No extra space needed.
Let's say you used the Gulper with the 10 - 11 - 8 sitch. You need 25.03 * 1.12 = 28 square meters.
What model yurt would the program recommend in this case? A Rambler.
Validate the input. Keep looping until the user enters valid deets. Rules:
- Small 🐑: integer from 0 to 100.
- Medium 🐑: integer from 0 to 70.
- Big 🐑: integer from 0 to 50.
- Ventilator: S, G, or C. Allow upper/lowercase. Allow extra spaces.
Some I/O:
- How many small sheep? 10
- How many medium sheep? 11
- How many big sheep? 8
- Ventilator (S=Sipper, G=Gulper, C=Chugger)? g
- Area required: 28
- Recommended model: Rambler
Round Area required to the nearest integer.
More I/O.
- How many small sheep? some
- Sorry, you must enter a whole number.
- How many small sheep? 22.2
- Sorry, you must enter a whole number.
- How many small sheep? -1
- Sorry, please enter a number one or more, and 100 or less.
- How many small sheep? 39939
- Sorry, please enter a number one or more, and 100 or less.
- How many small sheep? 30
- How many medium sheep? less
- Sorry, you must enter a whole number.
- How many medium sheep? 22
- How many big sheep? 17
- Ventilator (S=Sipper, G=Gulper, C=Chugger)? g
- Area required: 65
- Recommended model: Homesteader
Even more I/O.
- How many small sheep? 19
- How many medium sheep? 14
- How many big sheep? 9
- Ventilator (S=Sipper, G=Gulper, C=Chugger)? something
- Please enter S (Sipper), G (gulper, or C (Chugger).
- Ventilator (S=Sipper, G=Gulper, C=Chugger)? s
- Area required: 42
- Recommended model: Rambler
Upload a zip of your project folder. The usual coding standards apply.