Back

Code Challenge Set 1

Complete any 2 of the 4 below.

divider

What This Set Is For

Everything here takes something in, works something out, and says something back. That is sequencing — the first of the three building blocks every algorithm is made of, and the only one you have so far.

No decisions and no loops. If you find yourself needing one, you have read more into the brief than it says.

Write your requirements list before you write any code, and submit both.


This Set Is About What Nobody Told You

Every brief below is a person describing what they want, and every one of them leaves something out. Finding the gaps is the work.

Take a fragment of one of them and notice how much it does not say:

From the Tip Split brief
...and what tip we are leaving, and tell me what each
person pays.

That is a normal way for a person to describe what they want, and it is not enough to write a program from. Here is what should end up in your requirements list:

Requirements — the questions half
- Is the tip worked out on the whole bill, or on each share?
- How many decimal places? Money has two; Lua does not know that
- What if the bill does not divide evenly - who pays the extra cent?
- What is typed in, exactly? "18" or "0.18" or "18%"?
- What happens if someone types a word instead of a number?

There is no right answer to any of those. There is only a decision you made or a decision you did not notice. Two programs that answer them differently are both correct; a program whose author never thought about it is the one that goes wrong in front of somebody.


The Challenges

Pick any two.


Submit

For each of the two: the requirements list and the program folder.

The requirements list is the deliverable that is actually being read. The code is evidence you tried to satisfy your own list.

Worth 10 points, graded on completion.

Commence Challenge