Test 3 (Autumn Repeat):
B.Eng. (Telecommunications Engineering)
Test 3 (Autumn Repeat):
B.Eng. (Telecommunications Engineering)
This test is made up of two parts:
- Reformatting and correcting a given program.
- Modifying this corrected program in certain specified ways.
Note that marks will be awarded purely on the content of the final
report. Therefore, at all stages of the test, please describe your plans,
problems encountered, tests carried out and, when the
required tasks have been completed, describe any conclusions drawn from
the exercise.
The program PARLLEL.C is supposed to
calculate the equivalent resistance
of a set of separate
resistors
,
,
etc. connected in parallel, according to
the following equation:

The program is currently poorly laid out and formatted, and has various
other defects. You are required to:
- Present a reformatted version of the program which demonstrates
satisfactory practice for spacing, line breaking and indentation. Add
further comments if appropriate.
- Correct any errors or defects manifested at translation time
(i.e. during compilation and/or linkage). In the case of warnings, either resolve them or explain why they can be safely
ignored.
- Correct any defects manifested at run time. Ensure that you test
the program severely in an effort to reveal any remaining
defects.
Modify the program PARLLEL.C (as corrected in part 1) as follows:
- Separate the code for calculating the equivalent resistance into
a function of its own, suitably invoked by main().
- The original program prompts for just one "data set" (consisting
of the number of resistors, and their individual values) and then
carries out the calculation of equivalent resistance for that one data
set. Modify the program so that it repeatedly prompts for
additional data sets, calculating and displaying equivalent resistance
for each data set. This should continue until the value zero is entered
as the number of resistors. The program should then terminate.
Correct any defects manifested in your modified program. Ensure that you
test the program severely in an effort to reveal any remaining
run time defects.
McMullin@ugmail.eeng.dcu.ie
Fri Jun 30 12:53:42 BST 1995