Sunteți pe pagina 1din 7

Task 3

Design
Pseudo code

Variable table
Variable name
a

Type
Integer

Validation

Description

Must be an integer

Is an integer that
is used to
store results
etc.

Integer

Must be an integer

Is an integer that
is used to
store results
etc.

Integer

Must be an integer

Is an integer that
is used to
store results
etc.

number

Integer

Must be an integer

Acts as a range for


the functions
to run

lines

String

Must be an array/
list of the
names of the
students

Is a list of the
names from
the text files

tot

Integer

Must be an integer

An integer that is
based upon
the other
variables,
acting as a
total of the
scores

avlist

Float

A number

Calculates the
average of
the scores
etc.

totlist

Integer

Must be an integer

Contains the
overall score
for the
students

Test Plan
Test no.

Description

Test
data:1

Test
data:2

Test type

Does the
program use
the results
that are
stored in the
text file

Dave,
10,0,8
Emma
2,5,8

Class 2

Normal

Can the
program
retrieve
results from
separate
files

Dave,
10,0,8
Emma
2,5,8

Expected
outcome
1) Dave 10
Emma 8
2) Dave 10
Emma 8
3) Dave 6
Emma 5

Class 1
Class 2

Extreme

1) Dave 10
2) Dave 10
3) Dave 6
4) Emma 8
5) Emma 8
6) Emma 5

Proposed solution
The programming language being used is Python, where there are more
features that will benefit the code. Throughout the solution I will use the
append function to extend the lists. In addition there will be multiple for in
range functions to limit when the function is used, so that the correct
values are produced. The coded solution will have will have three different
functions that are required from the problem. Firstly, the names in
alphabetical order with the highest score for the tests. Secondly, the
scores sorted from highest to lowest. Thirdly, the average score for the
results, highest to lowest.
However, before that the variables will be defined at the start which will
be used throughout the program for multiple functions such as, an array
for the students results. This will be followed by the results from the
students, which will be retrieved from the text files created from the
students performance on the arithmetic quiz.

Development
Step 1

These are the variables that change throughout the code. The number variable is
the only one set to zero at the beginning, acting as a counter. The variables are
set as brackets as their values are put in through the text files etc.

Step2

Secondly, the variable lines is set. This variable opens the text file and reads the
lines. The following function then only works when the value of line is within
lines. The try function runs untill there is an integer, where a is extended as a
list. In addition this will also occur to b.

Step3

Thirdly I added a function that operates when the value of number is in range of
0 3 where the values of the list a will be returned. The variable tot is introduced
where a has number increasning by 3 incased in square parenteses.

Step4

This function takes two equal-length collections, and merges them together in
pairs. This then prints the variable number, followed by the value of x. this allows
the results to be sorted alphabetically, starting with the highest scores.

Step5

Then I h added the next part of the problem, where the average of the scores is
calculates by the avlist variable, sorting them into highest to lowest.

Step6

Testing
Summative Testing
Tes
t
no.

Descript
ion

Test
data:
1

Test
data:
2

Test
type

Expected
outcome

Actual
Pass/Fai
outcome l

Does the
program
use the
results
that are
stored in
the text
file

Dave,
10,0,
8
Emm
a
2,5,8

Class
2

Can the
program
retrieve
results
from
separate
files

Dave,
10,0,
8
Emm
a
2,5,8

Class
1

Normal

4) Dave 10
Emma 8

N/
A

Fai
l

N/
A

Fai
l

5) Dave 10
Emma 8
6) Dave 6
Emma 5
Extrem
e

Class
2

7) Dave 10
8) Dave 10
9) Dave 6
10)
E
mma 8
11)
E
mma 8
12)
E
mma 5

This was the outcome of the program:

With a limited amount of time left for the comtrolled assesment there
wasnt enough time to fix the code. However the code demonstrates a
good base of what is required, which is close to the actual solution. It
contains the three different requirements of the problem where the names
were in alphabetical order with their highest score, then by the highest
score- highest to lowest and finally an average of the scores- highest to
lowest. The problem came from accessing the file, where the error
message shows that there is no such file.

Evaluation
Overall Task 3, was by far the hardest. The success criteria that was put in
place at the start was not met as the program didnt output any of the
results. However there was a good attempt to the problem as there was a
function that would retrieve the results from the text files. A function that
sorts the students names into alphabetical order with their highest score,

a function that produces their scores highest to lowest and a function that
produces their average score highest to lowest. These were all required in
the problem where there were in a nutshell, three different outputs for the
students results.
The solution however was with incomplete code as the function to retrieve
the results from the text files wasnt complete, illustrated by the error
message. However given more time I think that I can produce a finished
working solution because the base of the code is in place. There are just
missing lines and parameters in the code which need to be put in place.
In addition there were major changes to the original design that is
illustrated by the pseudo code, as it was too simple. This meant I had to
add a lot more features to the actual code such as the append function,
where it extends the list and the for in range function, where the limits
can be defined. The actual code produced was clear to understand as
every major section was in separate parts. The first part contained the
defined variables that will be used throughout the program. The second
main part was retrieved the results from the text file. The third main
section sorted the names into alphabetical order with the highest score for
each student. The fourth main part calculated the average score for each
student and put them into an order of highest to lowest. The final main
section sorted the scores of the students from highest to lowest.

S-ar putea să vă placă și