Introduction to Computing – B142L
B142L Coursework assignment 2 – Referral
Academic year
2009/10
COURSEWORK DUE DATE
9pm May 21, 2010
COURSEWORK DESCRIPTION
Students are required to submit their coursework online using their individual coursework pages on the Mosaic website.
Coursework submissions MUST satisfy the following requirements:
- There will be at least one saved version per question answered.
- The answer to all questions must be written as one single program.
- Answers must not be copied from any printed sources, electronic sources or other people.
Answer all questions. This assessment has a
total of 20 marks.
Each question will be marked according to the following criteria:
| Marks | Criteria |
| 5 | Source code uses an effective design to answer the question, compiles without errors and includes informative comments. |
| 4 | Source code answers the question, compiles without errors and includes informative comments. |
| 3 | Source code answers the question and compiles without errors. |
| 2 | Source code is relevant to the question, but does not compile. |
| 1 | Source code is incorrect or not relevant to the question. |
Marks for this referral assessment will update the Coursework 2 mark according to the following table:
| Current mark | Maximum new mark |
| 13+ | Any higher |
| 11 – 12 | 14 |
| 9 – 10 | 12 |
| 8 | 10 |
| 0 – 7 | 8 |
COURSEWORK QUESTIONS
QUESTION 1
[
5 Marks]
Write a C program that uses a
stack or a
queue to store daily temperature values. The
data structure size must be 10. The program must:
- Accept 10 input temperature values
- Store them into the data structure
- Stop accepting input and end the program
QUESTION 2
[5 Marks]
In the same program as question 1, add source code to calculate the average temperature value for all the inputs stored in the data structure. The program must display a message, "Summer time!", if the average temperature is greater than 25 degrees Celsius. The program must display a message, "Winter time!", if the average temperature is less than 5 degrees Celsius. Otherwise, the program should not display any messages. The daily input temperature values are provided in Celsius.
QUESTION 3
[
5 Marks]
In the same program as question 1, add source code to
calculate and display the following information for all values in the data structure:
- Original Celsius temperature values
- Temperature values converted to Kelvin scale
- Temperature values converted to Fahrenheit scale
QUESTION 4
[
5 Marks]
In the same program as question 1, add source code to implement the following rule to handle missing input values:
- If there is less than 10 input temperature values, then the average of all the input values already provided should be used in place of the missing input values. For example, if there is only 8 input values, then the average of the 8 input values should be used in place of the missing 9th and 10th values.