Case Study

Here is an example of the detailed development of a simple project, using the approach I generally suggest for developing a program.

This approach is based on a spiral programming model, which I find to be easy and gets away from the "I have no idea where to start" problem many students (and others) have when starting almost any kind of project.

This project uses the Java programming language, but the approach can be applied to pretty much any language.

Requirements Analysis:

We present this in a table, using a question and answer format. The answers should normally be provided by whoever commissioned the code.

- Questions – posed by programmer/designer Answers
1 Should the numbers be in the code or input by the user? Input by the user.
2 Should the numbers be restricted to integers? No.
3 Should the program handle negative numbers? No.
4 Must the program behave well when confronted with unexpected input? No.
5 Should the program prompt the user for each number? Yes.
6 Should the program list all of the input? Not necessary.
7 What size numbers should the program handle? Agree with double.
8 To what accuracy should the program work? Agree with double.
9 Should the program quit after a single calculation? No.
10 Should the program be able to handle more than one currency or weight unit? Yes.
11 Which currencies? Dollars, Yen, Euros
12 Which weight units? Pounds, Grams
13 When should the user change weights? Every input.
14 When may the user change currencies or rates? Special flag, say -1 weight will indicate new currency or rate request.
15 How should the program quit? -1 for menu, the exit option
16 Should this project be developed using a single class and with the single method main? Yes.
17 Any other special coding requirements? Only use coding techniques presented so far in the course guide.
So far, we have not seen methods.