Predict, run, compare
A library fine is money for a late book: ₹1 a day. After more than 7 days late, you see the teacher. A chart is pinned above the desk. Does the chart match the rule?
Step 1 of 5
- Read the days late.
- The diamond asks: 7 days or more?
- A book 7 days late: Yes.
- The chart says: see the teacher.
- The rule says: pay ₹7.
No. For a book 7 days late, the chart and the rule differ.
The rule
Predict first. Run it. The first difference points to the bug. A bug is a mistake in a plan or program.
The rule says you see the teacher after more than 7 days. Find the book where the chart and the rule differ. A "7 or more" check includes 7. "More than 7" does not.
Watch out!
A chart that passes one test can still be wrong. The limit is the number where the rule changes. Try the day right at the limit too, here 7 days.
Make the chart agree with every book.
Loading lab…