Back to Challenge Set 6

Code Challenge: Drone Check

Difficulty  

divider

The Brief

What they asked for
I fly the drone for the school's video team and I keep
having to look the rules up. It is fine to go up if the wind
is under twenty and the battery is over thirty percent. But
not in the rain, ever, whatever the other two say. Tell me
yes or no, and if it is no, tell me which rule stopped me.

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


Notes

  • Three facts, and all three have to be right at once for the answer to be yes. Two of them are comparisons you write; the third arrives already true or false.
  • “Not in the rain” is the one that needs !. You could compare the boolean to false instead and it would work — Activity 1.12 says why ! reads better.
  • Rain is a yes-or-no, so read it with bool.Parse.
  • Saying which rule stopped them means a chain after the yes-or-no, and the order of that chain is a decision. If it is raining and the battery is flat, which one do you report? Say so in your requirements list.
  • Watch your boundaries. “Under twenty” and “over thirty percent” are both strict — decide what happens at exactly 20 and exactly 30, and write it down.

Sample Output

Sample Output
Wind speed (mph): 25 [Enter]
Battery (percent): 75 [Enter]
Is it raining? (true/false) false [Enter]
GROUNDED -- wind is 25 mph, limit is 20.

Test until every message you wrote has appeared at least once — that is the same per-branch check Activity 1.13 gave you for the rainfall chain. A message you never saw is a message you never tested.


Submit

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

Commence Challenge