SPrint1 and Sprint2 C Coding
A program is required to receive this data for each mine from the keyboard.
the number (integer) allocated to the mine
the year the mine opened
the year the mine closed
the total ore production
(eg. 9 1811 1880 17430 )
It should then output
the lifespan of each mine
the average yearly ore production of each mine
the total ore production of all the mines
the number of the mine with the longest lifespan
You can assume that
All mine lifespans are different
All data will be entered correctly
Test plan
Devise a series of test runs to thoroughly test the program. For each test run
Write down the test data explain what aspects of the program it will test,
Write down the expected results. Justify the results showing calculations and results.
Program Design
Using stepwise refinement produce an algorithm for the program, written in pseudo-code.
Produce a data table of identifiers
Coding
From your pseudo-code, write the program in C. make sure the program is clearly laid out and includes appropriate comments and indentations.
Testing
Using your test plan, run and debug the program. Produce evidence of testing.
Hand in
You should submit your design documents, test plan and evidence of testing. You should also submit an electronic version of your program, naming this program mine.cpp.
Both Sprint 2 and Sprint 3 will work independently of each other. Note that Sprint 3 is expected to work with the program written for Sprint 1 – but not with the version covered in Sprint 2.
Sprint 2 (20% of the marks)
Specification
After further consultation the historian has discovered that some mines had the same lifespan and there could be two or more mines with the highest lifespan.
Using your first sprint change the code to save the lifespans of each mine in an array, as they are calculated. The highest lifespan should be found, as before, but the numbers of the mines with the highest lifespan/s should be found and output after all the data has been entered.
(hint: as the lifespan is calculated hold in an array)
For this program you can assume that all data will be entered correctly.
Test plan
Can you use the same test data for this program? If so, explain how this is possible. If not, make up further test data.
Coding
Write the code required, developing the program from Sprint 1 (but making sure you keep a copy of that working program).
Testing
Using your test plan, run and debug the program. Produce evidence of testing.
Hand in
You should submit your test plan and evidence of testing. You should also submit an electronic version of your program naming this program mine2A.cpp.
10 years ago
Purchase the answer to view it
- sprint1.doc
- sprint2.doc