# The Sultan’s Jewel

The Sultan of Kapoor, wishing to reward a particularly talented grade 10 Computer Studies class, decided to set them a challenge. The reward was a lifetime supply of figs from the Sultan’s own orchards and the fabled El Surujah Emerald!  This emerald, 5cm in diameter, was embedded very securely in a snug teakwood box.  This box was in turn, fitted into a cedar box.  This box was similarly embedded, until the whole arrangement formed a cube, 10 metres to a side.  All the boxes, of rare and precious woods, had sides exactly 1.25cm thick, top, bottom and sides.  The gifted and talented students had the task of determining how many boxes there were without actually opening them. If the student calculated correctly, the prize was his.

You too can earn this prize (or at least a few marks) by writing a program to count how many boxes contained the Emerald.  Your quest is as follows:

1. Restate the problem in its essential terms.  Write the problem down in one sentence.  Next, state the RELEVANT facts you have been provided with.  Next, write a short paragraph outlining the steps you propose to take to solve the problem.

2. Devise the algorithm.  Write down the INPUTS to the program.  Your program must read three numbers:  The dimensions of the outermost box, the thickness of box walls, and the size of the jewel.  (After all, the Sultan may repeat this exercise with different details next time!)  Write down the OUTPUTS from the program.  Consider what VARIABLES you need to find the solution.

1. Test your algorithm on paper, by assigning some values to the INPUTS, working methodically through the PROCESS you outlined above, then checking your OUTPUTS.  You must test AT LEAST THREE different sets of Inputs.

2. At last, the moment you have been waiting for: Write the program.  Be sure to cater for faulty input or impossible input( eg negative numbers or inconsistent input).

3. Run the program:  Run the program with all your test data first to check if it gives the correct results.  Debug and rerun until answers are correct.  Finally, determine the correct answer to the problem presented.

Congratulations!  You have just performed the System Development Lifecycle Method of writing a program.

Credit Blundell@MonktonCoombe

This site uses Akismet to reduce spam. Learn how your comment data is processed.