Weather Record Program Testing
VerifiedAdded on 2019/10/18
|9
|3211
|238
Practical Assignment
AI Summary
This practical assignment involves testing a weather record program. Students are provided with a requirements specification and program design document. Part A requires creating a test plan, justifying the chosen test case generation techniques (e.g., equivalence partitioning, boundary value analysis), and listing comprehensive test cases. Part B demands executing the tests, recording actual and expected outcomes, documenting any defects found, and critically reviewing the testing approach. The assignment emphasizes thorough test coverage to reveal potential software faults and demonstrates understanding of testing methodologies. The marking scheme details the assessment criteria, highlighting the importance of clear test case specification, effective defect reporting, and insightful critical review.

Task
Using the attached Requirements Specification and Program Design for a software application (Weather Record
Program), devise and execute appropriate system tests for the application, and report on the outcome of your tests.
Explain why you have selected the test case derivation technique(s) that you used to derive your system tests. Critically
review your approach to testing this application.
The application will be available for testing immediately after the deadline for submitting Part A.
Deliverables
Part A (Test Plan)
Statement of which test case generation technique(s) were used, with your justification for their selection. (800
words maximum excluding references. State the word count at the end of the statement.)
List of test cases for the application, showing which test case generation technique was used to obtain each test
case.
Part B (Test Report)
Actual test data for each test.
Expected outcome for each test.
Actual outcome of each test.
Records of any defects in the software application identified during testing.
Critical review of your approach to testing the application. (400 words maximum, excluding references. State the
word count at the end of the review.)
Note: Although every effort has been made to ensure the quality of the attached requirements and detailed design for the
Weather Record Program, there is no guarantee that these are error-free!
Marking Scheme
Part A
Justification for selection of test case generation technique(s). Logical selection of appropriate test case
generation technique(s), with good justification for choice. (20 marks)
Test cases. Clear, comprehensive set of test cases, minimising duplication of tests; sufficiently clear for test data to
be derived easily and for tests to be set up by another tester. Effective use is made of the chosen test case
generation technique(s). (30 marks)
Part B
Records of testing. Test data and outcomes clearly linked to test cases. Appropriate choice of test data. Tests
can be repeated easily where appropriate. (15 marks)
Defect recording. Effectiveness of actual tests in detecting defects. Effective reporting of any defects detected.
(25 marks)
Critique of your approach to testing. Awareness of the strengths and weaknesses of the way you tackled both
parts of this assignment. (10 marks)
Template Version 1
Using the attached Requirements Specification and Program Design for a software application (Weather Record
Program), devise and execute appropriate system tests for the application, and report on the outcome of your tests.
Explain why you have selected the test case derivation technique(s) that you used to derive your system tests. Critically
review your approach to testing this application.
The application will be available for testing immediately after the deadline for submitting Part A.
Deliverables
Part A (Test Plan)
Statement of which test case generation technique(s) were used, with your justification for their selection. (800
words maximum excluding references. State the word count at the end of the statement.)
List of test cases for the application, showing which test case generation technique was used to obtain each test
case.
Part B (Test Report)
Actual test data for each test.
Expected outcome for each test.
Actual outcome of each test.
Records of any defects in the software application identified during testing.
Critical review of your approach to testing the application. (400 words maximum, excluding references. State the
word count at the end of the review.)
Note: Although every effort has been made to ensure the quality of the attached requirements and detailed design for the
Weather Record Program, there is no guarantee that these are error-free!
Marking Scheme
Part A
Justification for selection of test case generation technique(s). Logical selection of appropriate test case
generation technique(s), with good justification for choice. (20 marks)
Test cases. Clear, comprehensive set of test cases, minimising duplication of tests; sufficiently clear for test data to
be derived easily and for tests to be set up by another tester. Effective use is made of the chosen test case
generation technique(s). (30 marks)
Part B
Records of testing. Test data and outcomes clearly linked to test cases. Appropriate choice of test data. Tests
can be repeated easily where appropriate. (15 marks)
Defect recording. Effectiveness of actual tests in detecting defects. Effective reporting of any defects detected.
(25 marks)
Critique of your approach to testing. Awareness of the strengths and weaknesses of the way you tackled both
parts of this assignment. (10 marks)
Template Version 1
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

To achieve a First Class Mark:
Part A. The Test Cases are fully appropriate to the application and are highly likely to reveal faults in the software
application. Test coverage is demonstrably high. Almost every Test Case is clearly specified and its purpose is clear.
There are no unnecessary duplicate tests. The selection of test case generation techniques is well justified, with
reference to supporting evidence. Each Test Case has clearly been derived from a chosen test case generation
technique.
Part B. Almost all the defects in the software application have been detected, with no false positives reported. Each
defect is reported clearly. Test Records are comprehensive, and there is clear traceability between Test Cases, Test
Records and Defect Reports. Tests can easily be repeated. Test data are appropriate to each Test Case. Insight is
shown when critically reviewing the approach to testing, drawing on definitive sources where appropriate.
Weather Record Program
REQUIREMENTS SPECIFICATION
The input data, from a weather monitoring station, is to be read from a file weather.txt in the local
directory. The file format is specified below. You can assume that all weather.txt files have already been
validated and that the program will never be run with weather.txt files that do not conform to the format
specified below.
The program is required to:
a) Calculate summary data and write this to a summary.txt file. The summary.txt file format is specified
below.
b) Translate the daily weather data into diary format, and write this to a diary.txt file. The diary.txt
file format is specified below.
If the weather.txt file cannot be opened, then the program is required to terminate with an appropriate
error message.
FILE FORMATS
These are specified in extended BNF notation.
weather.txt
weather readings
::= header line, newline, 0{day readings}20;
header line
::= day number of first reading, space, pressure on previous day;
day number of first reading
::= "1" | "2" | .. | "366";;
::= (* Day number, within this year, of the first set of day readings *);
pressure on previous day
::= pressure;
day readings
Template Version 1
Part A. The Test Cases are fully appropriate to the application and are highly likely to reveal faults in the software
application. Test coverage is demonstrably high. Almost every Test Case is clearly specified and its purpose is clear.
There are no unnecessary duplicate tests. The selection of test case generation techniques is well justified, with
reference to supporting evidence. Each Test Case has clearly been derived from a chosen test case generation
technique.
Part B. Almost all the defects in the software application have been detected, with no false positives reported. Each
defect is reported clearly. Test Records are comprehensive, and there is clear traceability between Test Cases, Test
Records and Defect Reports. Tests can easily be repeated. Test data are appropriate to each Test Case. Insight is
shown when critically reviewing the approach to testing, drawing on definitive sources where appropriate.
Weather Record Program
REQUIREMENTS SPECIFICATION
The input data, from a weather monitoring station, is to be read from a file weather.txt in the local
directory. The file format is specified below. You can assume that all weather.txt files have already been
validated and that the program will never be run with weather.txt files that do not conform to the format
specified below.
The program is required to:
a) Calculate summary data and write this to a summary.txt file. The summary.txt file format is specified
below.
b) Translate the daily weather data into diary format, and write this to a diary.txt file. The diary.txt
file format is specified below.
If the weather.txt file cannot be opened, then the program is required to terminate with an appropriate
error message.
FILE FORMATS
These are specified in extended BNF notation.
weather.txt
weather readings
::= header line, newline, 0{day readings}20;
header line
::= day number of first reading, space, pressure on previous day;
day number of first reading
::= "1" | "2" | .. | "366";;
::= (* Day number, within this year, of the first set of day readings *);
pressure on previous day
::= pressure;
day readings
Template Version 1

::= max temp, min temp, space, pressure, space,
cloud cover, rainfall, space,
wind direction, wind speed, newline;
max temp
::= temp;
::= (*Maximum temperature during the day *);
min temp
::= temp;
::= (*Minimum temperature during the day *);
temp ::= digit, digit;
::= (* Temperature values are in degrees celsius. If the temperature is below zero, 50 is added to the
absolute value of the temperature: for example, -8 is recorded as 58. *);
pressure
::= digit, digit, digit;
::= (* Atmospheric pressure to nearest tenth of a millibar (mb), omitting the hundreds.The actual
pressure is derived from the following algorithm. Let the pressure digits be abc. If abc>550
then actual pressure is 9ab.c else actual pressure is 10ab.c. Atmospheric pressure over the
UK is normally in the range 960 mb to 1050 mb, so a value of 119 implies an actual pressure of
1011.9mb and a value of 916 implies 991.6mb *);
cloud cover
::= digit;
::= (* Measured in "oktas" - eights of sky covered. Values are in range 0-9, where for example 0 means
cloudless sky, 3 means cloud cover over 3/8 of sky, 8 means total cloud cover, 9 means unable
to determine cloud cover, usually due to dense fog *);
rainfall
::= digit, digit;
::= (* Total rainfall that day, in millimeters *);
wind direction
::= "00" | "01" | "02" | .. | "35";
::= (* The direction that the wind is coming from, measured in units of 10 degrees clockwise from
North. So a wind direction of 09 means 90 degrees clockwise from North. *);
wind speed
::= digit, digit;
::= (* Wind speed in miles per hour. *);
digit ::= "0" | "1" | .. | "9";
space ::= " ";
newline
::= (* Line terminator in file *);
summary.txt
summary data
::= no readings line | (header line, newline, temperature lines, newline,
rainfall lines, newline, wind line, newline);
no readings line
::= “No readings in file”, newline;
header line
::= "Summary data for days ", first day, " to ", last day, newline;
first day
::= day number;
Template Version 1
cloud cover, rainfall, space,
wind direction, wind speed, newline;
max temp
::= temp;
::= (*Maximum temperature during the day *);
min temp
::= temp;
::= (*Minimum temperature during the day *);
temp ::= digit, digit;
::= (* Temperature values are in degrees celsius. If the temperature is below zero, 50 is added to the
absolute value of the temperature: for example, -8 is recorded as 58. *);
pressure
::= digit, digit, digit;
::= (* Atmospheric pressure to nearest tenth of a millibar (mb), omitting the hundreds.The actual
pressure is derived from the following algorithm. Let the pressure digits be abc. If abc>550
then actual pressure is 9ab.c else actual pressure is 10ab.c. Atmospheric pressure over the
UK is normally in the range 960 mb to 1050 mb, so a value of 119 implies an actual pressure of
1011.9mb and a value of 916 implies 991.6mb *);
cloud cover
::= digit;
::= (* Measured in "oktas" - eights of sky covered. Values are in range 0-9, where for example 0 means
cloudless sky, 3 means cloud cover over 3/8 of sky, 8 means total cloud cover, 9 means unable
to determine cloud cover, usually due to dense fog *);
rainfall
::= digit, digit;
::= (* Total rainfall that day, in millimeters *);
wind direction
::= "00" | "01" | "02" | .. | "35";
::= (* The direction that the wind is coming from, measured in units of 10 degrees clockwise from
North. So a wind direction of 09 means 90 degrees clockwise from North. *);
wind speed
::= digit, digit;
::= (* Wind speed in miles per hour. *);
digit ::= "0" | "1" | .. | "9";
space ::= " ";
newline
::= (* Line terminator in file *);
summary.txt
summary data
::= no readings line | (header line, newline, temperature lines, newline,
rainfall lines, newline, wind line, newline);
no readings line
::= “No readings in file”, newline;
header line
::= "Summary data for days ", first day, " to ", last day, newline;
first day
::= day number;
Template Version 1

::= (* Day number of first reading in the set *);
last day
::= day number;
::= (* Day number of last reading in the set *);
day number
::= "1" | "2" | .. | "386";
::= (* Day number relative to the start of the year of the first reading *);
temperature lines
::= max mean line, newline, min mean line, newline;
max mean line
::= "Mean maximum temperature: ", mean temp;
min mean line
::= "Mean minimum temperature: ", mean temp;
mean temp
::= temp, ".", digit, digit;
::= (* Mean temperature over the period in degrees celsius. *);
temp ::= [-], [digit], digit;
::= (* Temperature in degrees celsius, shown as negative if below zero. *);
rainfall lines
::= total rainfall line, newline, [wettest day line], newline, dry days line;
total rainfall line
::= "Total rainfall (mm): ", rain;
rain ::= 1{digits}3;
::= (* The total amount of rain this period in millimeters *);
wettest day line
::= "Wettest day: ", day rain, " mm on ", top day;
::= (* This line is omitted if no rain fell during this period. *);
day rain
::= 1{digits}2;
::= (* The amount of rain that day in millimeters *);
top day
::= day number | (day number, " & ", day number) | "Several days" ;
::= (* Day number of wettest day. If two days are equally wet, both day numbers are given. If more
than two days are equally wet, then "Several days". *);
day number
::= "1" | "2" | .. | "396";
::= (* Day number relative to the start of the year of the first reading *);
dry days line
::= "Number of dry days: ", number of days;
::= (* Number of days when the rainfall was zero. *);
wind line
::= "Number of calm days: ", number of days;
::= (* Number of days when the wind speed was zero. *);
number of days
::= ["1" | "2" | "3"], digit;
digit ::= "0" | "1" | .. | "9";
space ::= " ";
newline
::= (* Line terminator in file *);
Template Version 1
last day
::= day number;
::= (* Day number of last reading in the set *);
day number
::= "1" | "2" | .. | "386";
::= (* Day number relative to the start of the year of the first reading *);
temperature lines
::= max mean line, newline, min mean line, newline;
max mean line
::= "Mean maximum temperature: ", mean temp;
min mean line
::= "Mean minimum temperature: ", mean temp;
mean temp
::= temp, ".", digit, digit;
::= (* Mean temperature over the period in degrees celsius. *);
temp ::= [-], [digit], digit;
::= (* Temperature in degrees celsius, shown as negative if below zero. *);
rainfall lines
::= total rainfall line, newline, [wettest day line], newline, dry days line;
total rainfall line
::= "Total rainfall (mm): ", rain;
rain ::= 1{digits}3;
::= (* The total amount of rain this period in millimeters *);
wettest day line
::= "Wettest day: ", day rain, " mm on ", top day;
::= (* This line is omitted if no rain fell during this period. *);
day rain
::= 1{digits}2;
::= (* The amount of rain that day in millimeters *);
top day
::= day number | (day number, " & ", day number) | "Several days" ;
::= (* Day number of wettest day. If two days are equally wet, both day numbers are given. If more
than two days are equally wet, then "Several days". *);
day number
::= "1" | "2" | .. | "396";
::= (* Day number relative to the start of the year of the first reading *);
dry days line
::= "Number of dry days: ", number of days;
::= (* Number of days when the rainfall was zero. *);
wind line
::= "Number of calm days: ", number of days;
::= (* Number of days when the wind speed was zero. *);
number of days
::= ["1" | "2" | "3"], digit;
digit ::= "0" | "1" | .. | "9";
space ::= " ";
newline
::= (* Line terminator in file *);
Template Version 1
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

diary.txt
diary := 0{day entry}20
day entry
::= day number, space, wind speed, space, [wind direction, space],
cloud, space, rain, space,
"Pressure", space, pressure change, newline;
day number
::= "1" | "2" | .. | "386";
::= (* Day number relative to the start of the year of the first reading *);
wind speed
::= "Calm" | "Light" | "Moderate" | "Fresh" |
"Strong" | "Gale" | "Severe Gale" ;
::= (* Derived from the WindSpeed table below. *);
wind direction
::= "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" ;
::= (* The direction that the wind is coming from, where N is North and SE is South East, etc.. This is
calculated from the wind direction in degrees, where 0 is North (as are 10, 20, 340 and 350), 30,
40, 50 and 60 are North-East, 70, 80, 90, 100 and 110 are East, etc.. Wind direction is omitted if
the wind speed is calm. *);
cloud ::= ( "sunny" [, " intvls."] ) | "overcast" | "foggy" ;
::= (* sunny if cloud cover is 0-2 oktas, sunny intvls. if cloud cover is 3-5 oktas, overcast if
cloud cover is 6-8 oktas, foggy if cloud cover is 9 oktas. *);
rain ::= "Fair " | "Rain " ;
::= (* Fair if no rain fell that day, otherwise Rain *);
pressure change
::= "Rising " | "Falling " | "Steady ";
::= (*Rising (or Falling) if the pressure this day is greater (or less) than the pressure the previous
day, or Steady if the pressure is unchanged from the previous day. *);
space ::= " ";
newline
::= (* Line terminator in file *);
WindSpeed is derived from the table
Wind Speed in miles per hour WindSpeed
0 Calm
1-12 Light
13-18 Moderate
19-24 Fresh
25-38 Strong
39-46 Gale
>46 Severe Gale
Template Version 1
diary := 0{day entry}20
day entry
::= day number, space, wind speed, space, [wind direction, space],
cloud, space, rain, space,
"Pressure", space, pressure change, newline;
day number
::= "1" | "2" | .. | "386";
::= (* Day number relative to the start of the year of the first reading *);
wind speed
::= "Calm" | "Light" | "Moderate" | "Fresh" |
"Strong" | "Gale" | "Severe Gale" ;
::= (* Derived from the WindSpeed table below. *);
wind direction
::= "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" ;
::= (* The direction that the wind is coming from, where N is North and SE is South East, etc.. This is
calculated from the wind direction in degrees, where 0 is North (as are 10, 20, 340 and 350), 30,
40, 50 and 60 are North-East, 70, 80, 90, 100 and 110 are East, etc.. Wind direction is omitted if
the wind speed is calm. *);
cloud ::= ( "sunny" [, " intvls."] ) | "overcast" | "foggy" ;
::= (* sunny if cloud cover is 0-2 oktas, sunny intvls. if cloud cover is 3-5 oktas, overcast if
cloud cover is 6-8 oktas, foggy if cloud cover is 9 oktas. *);
rain ::= "Fair " | "Rain " ;
::= (* Fair if no rain fell that day, otherwise Rain *);
pressure change
::= "Rising " | "Falling " | "Steady ";
::= (*Rising (or Falling) if the pressure this day is greater (or less) than the pressure the previous
day, or Steady if the pressure is unchanged from the previous day. *);
space ::= " ";
newline
::= (* Line terminator in file *);
WindSpeed is derived from the table
Wind Speed in miles per hour WindSpeed
0 Calm
1-12 Light
13-18 Moderate
19-24 Fresh
25-38 Strong
39-46 Gale
>46 Severe Gale
Template Version 1

Weather Record Program
PROGRAM DESIGN – pseudocode in Structured English
(With line numbers)
001 *** Design of weather readings.
002 *** This will include:
003 *** Number of the first day relative to start of year;
004 *** Pressure on the previous day;
005 *** Number of day entries;
006 *** For each day:
007 *** max_temp, min_temp, pressure,
008 *** (after conversion in each case)
009 *** cloud_cover, rainfall,
010 *** wind_direction, wind_speed.
020 BEGIN
021 *** Read weather file
022 set number_of_records to zero
023 clear error_flag
024 try to open weather.txt file
025 IF cannot open weather.txt file
026 THEN
027 DISPLAY error message
028 set error flag
029 ELSE
030 READ first_day_number from weather.txt file
031 READ previous_pressure from weather.txt file
032 convert previous_pressure to millibars
033 set day_number to first_day_number
034 LOOP for each day-worth of weather readings
in the weather.txt file,up to 20 days
035 READ max_temp for this day
036 convert max_temp to degrees celsius
037 READ min_temp for this day
038 convert min_temp to degrees celsius
039 READ pressure for this day
040 convert pressure to millibars
041 READ cloud_cover for this day
042 READ rainfall for this day
043 READ wind_direction for this day
044 READ wind_speed for this day
045 increment number_of_records by 1
046 increment day_number by 1
047 ENDLOOP when all weather readings read
048 close weather.txt file
049 *** write summary:
050 set sum_of_max_temps to zero
051 set sum_of_min_temps to zero
052 set total_rainfall to zero
Template Version 1
PROGRAM DESIGN – pseudocode in Structured English
(With line numbers)
001 *** Design of weather readings.
002 *** This will include:
003 *** Number of the first day relative to start of year;
004 *** Pressure on the previous day;
005 *** Number of day entries;
006 *** For each day:
007 *** max_temp, min_temp, pressure,
008 *** (after conversion in each case)
009 *** cloud_cover, rainfall,
010 *** wind_direction, wind_speed.
020 BEGIN
021 *** Read weather file
022 set number_of_records to zero
023 clear error_flag
024 try to open weather.txt file
025 IF cannot open weather.txt file
026 THEN
027 DISPLAY error message
028 set error flag
029 ELSE
030 READ first_day_number from weather.txt file
031 READ previous_pressure from weather.txt file
032 convert previous_pressure to millibars
033 set day_number to first_day_number
034 LOOP for each day-worth of weather readings
in the weather.txt file,up to 20 days
035 READ max_temp for this day
036 convert max_temp to degrees celsius
037 READ min_temp for this day
038 convert min_temp to degrees celsius
039 READ pressure for this day
040 convert pressure to millibars
041 READ cloud_cover for this day
042 READ rainfall for this day
043 READ wind_direction for this day
044 READ wind_speed for this day
045 increment number_of_records by 1
046 increment day_number by 1
047 ENDLOOP when all weather readings read
048 close weather.txt file
049 *** write summary:
050 set sum_of_max_temps to zero
051 set sum_of_min_temps to zero
052 set total_rainfall to zero
Template Version 1

053 set number_dry_days to zero
054 set number_calm_days to zero
055 set day_records_read to zero
056 try to open summary.txt file
057 IF summary.txt file cannot be opened
058 THEN
059 DISPLAY error message
060 ELSE
061 day_number = number_of_first_day
062 LOOP for each day entry in weather readings
063 add max_temp to sum_of_max_temps
064 add min_temp to sum_of_min_temps
065 add rainfall to total_rainfall
066 IF rainfall = 0
067 THEN
068 increment number_dry_days by 1
069 ENDIF
070 IF wind_speed = 0
071 THEN
072 increment number_calm_days by 1
073 ENDIF
074 IF first day record
075 THEN
076 set highest_rainfall to rainfall
077 set wettest_day to day_number
078 set number_wettest_days to 1
078 ELSE
080 IF rainfall > highest_rainfall
081 THEN
082 set highest_rainfall to rainfall
083 set wettest_day to day_number
084 set number_wettest_days to 1
085 ELSE
086 IF rainfall = highest_rainfall
087 THEN
088 increment number_wettest_days by 1
089 set other_wettest_day to day_number
090 ENDIF
091 ENDIF
092 ENDIF
093 increment day_records_read by 1
094 increment day_number by 1
095 ENDLOOP
096 *** Write summary file
097 *** so all WRITES are to summary.txt file
098 IF day_records_read = 0
099 THEN
100 WRITE “No readings in file”
101 ELSE
102 WRITE header line
103 WRITE mean max temp line
104 WRITE mean min temp line
105 WRITE total rainfall line
106 IF number_wettest_days > 0
Template Version 1
054 set number_calm_days to zero
055 set day_records_read to zero
056 try to open summary.txt file
057 IF summary.txt file cannot be opened
058 THEN
059 DISPLAY error message
060 ELSE
061 day_number = number_of_first_day
062 LOOP for each day entry in weather readings
063 add max_temp to sum_of_max_temps
064 add min_temp to sum_of_min_temps
065 add rainfall to total_rainfall
066 IF rainfall = 0
067 THEN
068 increment number_dry_days by 1
069 ENDIF
070 IF wind_speed = 0
071 THEN
072 increment number_calm_days by 1
073 ENDIF
074 IF first day record
075 THEN
076 set highest_rainfall to rainfall
077 set wettest_day to day_number
078 set number_wettest_days to 1
078 ELSE
080 IF rainfall > highest_rainfall
081 THEN
082 set highest_rainfall to rainfall
083 set wettest_day to day_number
084 set number_wettest_days to 1
085 ELSE
086 IF rainfall = highest_rainfall
087 THEN
088 increment number_wettest_days by 1
089 set other_wettest_day to day_number
090 ENDIF
091 ENDIF
092 ENDIF
093 increment day_records_read by 1
094 increment day_number by 1
095 ENDLOOP
096 *** Write summary file
097 *** so all WRITES are to summary.txt file
098 IF day_records_read = 0
099 THEN
100 WRITE “No readings in file”
101 ELSE
102 WRITE header line
103 WRITE mean max temp line
104 WRITE mean min temp line
105 WRITE total rainfall line
106 IF number_wettest_days > 0
Template Version 1
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

107 THEN
108 WRITE “Wettest day”, highest_rainfall, “on”
109 IF number_wettest_days = 1
110 THEN
111 WRITE wettest_day
112 ELSE
113 WRITE wettest_day
114 WRITE other_wettest_day (or “Several days”)
115 ENDIF
116 ENDIF
117 WRITE dry days line
118 WRITE wind line
119 ENDIF
120 close weather.txt file
121 ENDIF
122 *** write diary file
123 try to open diary.txt file
124 IF diary.txt file cannot be opened
125 THEN
126 DISPLAY error message
127 ELSE
128 last_pressure = pressure on previous day
129 day_number = Number of first day
130 LOOP for each day entry in weather readings
131 *** Write diary to file
132 *** so all WRITES are to diary.txt file
133 WRITE day_number
134 SWITCH on wind_speed
135 CASE wind_speed > 46
136 WRITE “Severe Gale”
137 CASE 46 >= wind_speed > 38
138 WRITE “Gale”
139 CASE 38 >= wind_speed > 24
140 WRITE “Strong”
141 CASE 24 >= wind_speed > 18
142 WRITE “Fresh”
143 CASE 18 >= wind_speed > 12
144 WRITE “Moderate”
145 CASE 12 >= wind_speed > 0
146 WRITE “Light”
147 CASE wind_speed <= 0
148 WRITE “Calm”
149 ENDSWITCH
150 IF wind_speed > 0
151 THEN
152 WRITE wind direction
153 *** Calculate this as in the spec.
154 ENDIF
155 SWITCH on cloud_cover
156 CASE cloud_cover 0, 1 or 2
157 WRITE “Sunny”
158 CASE cloud_cover 3, 4 or 5
159 WRITE “Sunny intvls.”
Template Version 1
108 WRITE “Wettest day”, highest_rainfall, “on”
109 IF number_wettest_days = 1
110 THEN
111 WRITE wettest_day
112 ELSE
113 WRITE wettest_day
114 WRITE other_wettest_day (or “Several days”)
115 ENDIF
116 ENDIF
117 WRITE dry days line
118 WRITE wind line
119 ENDIF
120 close weather.txt file
121 ENDIF
122 *** write diary file
123 try to open diary.txt file
124 IF diary.txt file cannot be opened
125 THEN
126 DISPLAY error message
127 ELSE
128 last_pressure = pressure on previous day
129 day_number = Number of first day
130 LOOP for each day entry in weather readings
131 *** Write diary to file
132 *** so all WRITES are to diary.txt file
133 WRITE day_number
134 SWITCH on wind_speed
135 CASE wind_speed > 46
136 WRITE “Severe Gale”
137 CASE 46 >= wind_speed > 38
138 WRITE “Gale”
139 CASE 38 >= wind_speed > 24
140 WRITE “Strong”
141 CASE 24 >= wind_speed > 18
142 WRITE “Fresh”
143 CASE 18 >= wind_speed > 12
144 WRITE “Moderate”
145 CASE 12 >= wind_speed > 0
146 WRITE “Light”
147 CASE wind_speed <= 0
148 WRITE “Calm”
149 ENDSWITCH
150 IF wind_speed > 0
151 THEN
152 WRITE wind direction
153 *** Calculate this as in the spec.
154 ENDIF
155 SWITCH on cloud_cover
156 CASE cloud_cover 0, 1 or 2
157 WRITE “Sunny”
158 CASE cloud_cover 3, 4 or 5
159 WRITE “Sunny intvls.”
Template Version 1

160 CASE cloud_cover 6, 7 or 8
161 WRITE “Overcast”
162 CASE cloud_cover 9
163 WRITE “Foggy”
164 ENDSWITCH
165 IF rainfall > 0
166 THEN
167 WRITE “Rain”
168 ELSE
169 WRITE “Fair”
170 ENDIF
171 WRITE “Pressure”
172 SWITCH pressure
173 CASE pressure > last_pressure
174 WRITE “Rising”
175 CASE pressure = last_pressure
176 WRITE “Steady”
177 CASE pressure < last_pressure
178 WRITE “Falling”
179 ENDSWITCH
180 last_pressure = pressure
181 increment day_number by 1
182 ENDLOOP
183 close diary.txt file
184 ENDIF
185 ENDIF
186 END
End of Program Design (pseudocode)
Template Version 1
161 WRITE “Overcast”
162 CASE cloud_cover 9
163 WRITE “Foggy”
164 ENDSWITCH
165 IF rainfall > 0
166 THEN
167 WRITE “Rain”
168 ELSE
169 WRITE “Fair”
170 ENDIF
171 WRITE “Pressure”
172 SWITCH pressure
173 CASE pressure > last_pressure
174 WRITE “Rising”
175 CASE pressure = last_pressure
176 WRITE “Steady”
177 CASE pressure < last_pressure
178 WRITE “Falling”
179 ENDSWITCH
180 last_pressure = pressure
181 increment day_number by 1
182 ENDLOOP
183 close diary.txt file
184 ENDIF
185 ENDIF
186 END
End of Program Design (pseudocode)
Template Version 1
1 out of 9
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.