Spring 1995
The exercise consists of two parts. Marks will be divided equally between the two parts. The report should have separate Plan, Coding and Testing sections for the two parts; there should be a single Conclusion section.
The two parts are independent (i.e. you do not have to complete the first in order to attempt the second, or vice versa). Therefore, it is recommended that you plan your allocation of time between the two parts carefully in advance, and stick to this allocation during the test.
Consider the file TRIANG.C.
This is supposed to be a C program to calculate the area of a triangle. It should request measurements of the relevant dimensions of the triangle, to be input from the keyboard, calculate the area, and display the result on the screen.
The program has various deficiencies. You are required to correct all deficiencies you can identify. For all changes that you make, the report should contain a clear statement of the change and a specific explanation of your rationale for the change. Of course, if you are making several similar or related changes, you may discuss these as a unit.
When you have reached the point where you think the program should work, then you should test it, and report on these tests. Carry out, and report on, further corrections if necessary.
You are required to develop (code, test, debug) a C program to carry out the following calculation. Given a quadratic equation of the form:
the roots - if they exist - are given by the equation:
Your program should get values for the coefficients a, b and c, and print out the roots of the equation.
Your program must do the following: