Back to Challenge Set 4

Code Challenge: Return Window

Difficulty  

divider

The Brief

What they asked for
Our returns policy is thirty days for a full refund and store
credit after that. The problem is nobody agrees what happens on
day thirty itself, including my own staff, and I have had two
arguments about it this month. Type in how many days it has
been and settle it.

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.
  • The boundary is not a detail here — it is the whole brief. They told you day thirty is what people argue about. Your requirements list has to say what your program does on day 30 and why.
  • There is no wrong choice, only an undocumented one. A program that is defensible either way and says which way it went is complete. A program that got there by accident is not.
  • Days are whole numbers. Think about what your program should do if someone types a negative one, and say so in your list even if you decide to ignore it.

Sample Output

Sample Output
Days since purchase: 12
Full refund.

A purchase 45 days old should get store credit only. Test 29, 30, and 31, and make sure the answer at 30 is the one your requirements list promised.


Submit

Your requirements list and your program file, named cc-return-window.

Commence Challenge