Java Reference
In-Depth Information
First, estimate realistically how much time it will take you to
ȗ
Design the program logic
ȗ
Develop test cases
ȗ
Type the program in and fix syntax errors
ȗ
Test and debug the program
For example, for the income tax program I might estimate 30 minutes for the
design, because it is mostly done; 30 minutes for developing test cases; one hour
for data entry and fixing syntax errors; and 2 hours for testing and debugging.
That is a total of 4 hours. If I work 2 hours a day on this project, it will take me
two days.
Then think of things that can go wrong. Your computer might break down. The
lab might be crowded. You might be stumped by a problem with the computer
system. (That is a particularly important concern for beginners. It is very
common to lose a day over a trivial problem just because it takes time to track
down a person who knows the Ȓmagicȓ command to overcome it.) As a rule of
thumb, double the time of your estimate. That is, you should start four days, not
two days, before the due date. If nothing goes wrong, great; you have the
program done two days early. When the inevitable problem occurs, you have a
cushion of time that protects you from embarrassment and failure.
203
204
A DVANCED T OPIC 5.3: Enumerated Types
In many programs, you use variables that can hold one of a finite number of
values. For example, in the tax return class, the status field holds one of the
values SINGLE or MARRIED . We arbitrarily defined SINGLE as the number 1
and MARRIED as 2. If, due to some programming error, the status field is set
to another integer value (such as ɨ1, 0, or 3), then the programming logic may
produce invalid results.
In a simple program, this is not really a problem. But as programs grow over
time, and more cases are added (such as the Ȓmarried filing separatelyȓ and
Ȓhead of householdȓ categories), errors can slip in. Java version 5.0 introduces a
Search WWH ::




Custom Search