Back to Challenge Set 4

Code Challenge: Fever Check

Difficulty  

divider

The Brief

What they asked for
I run the nurse's office and I need a quick screening tool.
Type in a student's temperature and tell the front desk
whether they're cleared for class or need to go home. Our
school's policy is simple: 100.4 or higher means home.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • Two outcomes, so this is one if with one else. It does not need a chain.
  • Temperatures are not whole numbers. Pick your parse accordingly.
  • The brief already gives you the number. This one has no calculation inside the decision — the whole job is picking the right comparison.
  • A student at exactly 100.4 has to get one answer. The brief says “100.4 or higher,” which tells you which comparison operator belongs here.

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.

  1. Get the temperature and parse it with double.Parse.
  2. Write the if for the fever case first, using the comparison the brief tells you.
  3. Add the else for everything else.
  4. Test 99.1, 100.4, and 101.2 before you submit — those three are where a boundary mistake shows up.

Sample Output

Sample Output
Temperature? 101.2
Send home. 100.4 or higher is a fever by school policy.

Verified in a real run. A temperature of 99.1 should print “Cleared for class.” instead — and 100.4 exactly should still say send home, since the brief includes the boundary.


Submit

Your requirements list and your program file, named cc-fever-check.

Commence Challenge