Our club is ordering hats and nobody knows their size. If
people can measure around their head and type the number in,
I can tell them small, medium, or large and stop getting
guesses.
Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.
Notes
Head circumference is measured in inches, and it is not a whole number.
The exact ranges are yours to choose. Look up rough ones or invent your own, but write them in your requirements list.
A number sitting exactly on a boundary must get one answer, not two and not none. That is what a chain gives you for free and separate if statements do not.
Someone will measure wrong and type 3, or 300. Decide what your program says to them, and say so in your list.
Where to Start
Only one-star challenges have this section. If you already know how to begin, skip it — and when you move up to two stars, working out the order yourself is part of the job.
Write your three size ranges down on paper before you touch the keyboard.
Get the measurement and parse it with double.Parse.
Write the chain from largest down, or smallest up — pick one and stay consistent. Activity 1.13's rule is most specific first.
Test a number sitting exactly on one of your boundaries.
Sample Output
Sample Output
Head circumference (inches): 22.5
That is a Medium.
The exact ranges are yours. What matters is that every number from 0 up gets exactly one answer, and that the answer at each boundary is the one you meant.
Submit
Your requirements list and your program file, named cc-hat-size-checker.