Documente Academic
Documente Profesional
Documente Cultură
1 | Page
Contents
1. Introduction
2. Task 1
a) Analysis
b) Success criteria
c) Programming techniques
d) Variables and validation
e) Test plan
f) Algorithms
g) Development evidence
h) Testing
i) Contents
2 | Page
Introduction
Task 1
For this task, I have been asked to create a program that will test primary school
children on their basic arithmetic skills.
The program should generate a quiz consisting of randomised questions using any
two numbers and addition, subtraction and multiplication. It will have to be able to
record the students name and ask 10 questions and mark the questions out of 10
I will also be using an array of variables that will allow for more than one change at a
time. Task 1 heavily relies on the Arithmetic and logic unit (ALU) of the CPU (Central
processing unit) because task 1 mostly consists of calculations and logic in the
sense of adding, subtracting, dividing and multiplication. In addition, the program
works off the ram meaning no information is stored on the hard drive/solid state drive
and when the program ends or the computer is turned off the programs information
is lost and no longer exists.
For task 1, task 2 and task 3 I will be using a High level programming language. A
high-level language is usually stated high level because of it similarity to human
language. languages like FORTRAN, C, C++ and python are all very similar to
human languages, but languages like Befunge, chef and FALSE are all high-level
languages that are not similar to human languages because of the complexity these
types of languages are called esoteric programming languages.
Success criteria
3 | Page
Techniques
For this task, I will be using python 2.7 as a high-level language and I have thought
about what techniques I will need to use this includes:
Variables something that will change, I will be using variables for answering
the test and as conditioning/validation. Like when I question = 0 #setting all
varibles to be empty and clear before the program runs
Iteration loop validation, to loop until answer is within validation ranges.
Like when I while question < 11: #this while loop will make sure that the
program underneath runs till the variable reaches a certain value
Constant - something that will stay the same (name, etc.). Like when I NAME
= raw_input("Please type your name here: ") #i set name input as a
constant (a value that stays the same) because throughout the time the
program is running the name will not change
Conditioning validate sequence. Like when I else: #if not the correct
answer to the question then it will display the following
print "Incorrect,the correct answer = " + str(correct_answer) + "."
#tells you if you are incorrect and gives correct answer
Score - to mark questions right or wrong and mark accordingly and to count
and remember correct answers. Like when I marks = marks + 1 #adds 1 to
the mark variable
Operator - to use characters, such as (+/*-). Like when I if operater_1 == 3:
# if operater_3 equals 3 the this loop becomes in action
print str(unit_1) + " - " + (unit_2) #adds 1 to the question variable so
that only 10 questions are asked no matter what generates the sum
question = question + 1 #adds 1 to the question variable so that only
10 questions are asked no matter what
answer = input()#user input for question
correct_answer = unit_1 - unit_2#program works out correct answer
Integers - number based answers (validation). Like when I unit_2 =
random.randint (1,10)
Functions to create functions such as random and time. Like when I import
time #imports functions for the possibility for time which allows you to create
stops in the program
Logic and or Not. Like when I while question < 11:
4 | Page
Variable table
Variable name
answers
Data type
Alphanumeric
Numbers
gender
Boolean, yes/no
question
String
correct_answer
String
unit_1
Sting
unit_2
String
operater_1
string
marks
String
Role
To answers
the math
questions
To input
gender
Works out how
many
questions
have been
asked
Counts the
amount of
correct answer
Is the variable
that stores the
random
integers
Is the variable
that stores the
random
integers
Randomly
generates the
numeric
operator
Gives the
players there
marks
validation
To stop players from
entering words in
number questions
Male/female
Can only be changed
by program
Cannot be edited by
user
Cannot be edited by
the user
5 | Page
Test plan
Success criteria
How tested
The program
must be able to
generate maths
quiz
to ask and
remember
students name
Must have a
range of
random integer
Must Not have
repetitive
questions
The programs
able to mark
questions and
put right
answers
Must be able to
reset
Must cover all
arithmetic
operations(+-x)
Validation
(name has to be
in string)
( answers have
to be
real/integers)
Questions must
be appropriate
for their age
Score the
questions
Questions must
be clear and
easy to
understand
Expected
outcome
Will generate
the 10
questions
randomly
Actual outcome
Action
Will remember
name and
allow long
names
Will create
random
integers
Will not repeat
Will mark
correct and
put right
answer
Will reset
7 | Page
Flow chart
8 | Page
Pseudo code
Start
Input time
Input
random
Input = name
Character = check
Output =
Set question =
instructions/guide
0
Set mark = 0
While
+) + random
Input
If correct
question +1 mark +1
Repeat program
branching
Else
incorrect question +1
Repeat program
Elif question
= 10
Output
marks
End
Pseudo code is
a high-level
language that is
not linked to any
pseudo code is used to help plan
follow, including decisions, technique and variables. Doing pseudo code helps me
know what the aim of my code is and makes it easier for me to create the code.
Indentation in the code is called branching this represents the fact that the code
cannot continue without completing the branch.
10 | P a g e
11 | P a g e
Test
Success criteria
How tested
Expected
outcome
Will generate
the 10
questions
randomly
Actual outcome
The program
must be able to
generate maths
quiz
Will remember
name and
allow long
names
Remembered
name and
allowed long
names
Will create
random
integers
Will not repeat
Randomly
created integers
Will mark
correct and
put right
answer
Marked correctly
and put right
answer
Will reset
Score the
questions
Will score
questions
to ask and
remember
students name
Must have a
range of
random integer
Must Not have
repetitive
questions
The programs
able to mark
questions and
put right
answers
Must be able to
reset
Questions must
be clear and
Generated the
10 questions
randomly
Validation will
work and only
appropriate
will be allowed
to be inputted
Answers were
only integers
The question
will be easy to
Action
Try to input a
restart loop
Did not
approach
stopping
negative
questions
The questions
were easy to
12 | P a g e
understand and
made sense
13 | P a g e
My test runs, asks for name and displays instructions it then displays ten questions
one by one and says whether u are correct or incorrect if in the case you are
incorrect it displays the correct answer at the end of the program it displays how
many questions you got correct.
14 | P a g e
Conclusion
My program work for task one in the way I wanted it to. The program asks ten questions of
different arithmetic operations and random integers, this worked very well but their problem
trying to stopping negative questions and I did not approach fixing this error in the program,
also I had a problem with the programs restart loop. I tried to implement a restart loop but it
just caused my program to fail and give errors, which I did not have time to fix so I removed
it completely and left it working.
My program fulfils most of my success criteria apart from a few points which I was unable to
test or fix such as the stopping questions that required answers that were negative numbers
which I did not try and fix because of the time zone we had and the unclearly of how to
approach fixing that problem.
Must be able to ask and remember students name the quiz has variable that allows
the program to remember students names.
Must have a range of random integers the integers are randomly generated,
ranging between 1 and 10.
Must not have repetitive questions there is no validation for this because
The programs able to mark questions and put right answers the program marks
and checks the answer and marks it on whether it is correct or not.
Must be able to reset for the next student the program does not reset and requires
the program to reboot in order to reset.
Must cover all arithmetic operations (+-*/) the program uses all the operation but
division because the user cannot enter decimal point numbers because the program
cannot register numbers less than one.
Questions must be appropriate for their age - questions are limited to only integers
between 1 and 10.
Questions must be clear and easy to understand - all questions are laid out in a very
simple clear understandable way.
15 | P a g e
The problem with task 1 is that it runs off volatile memory Aka the RAM, this means that the
names and results collected by the quiz are lost as soon as the program is shutdown this is
fix in task 2 where the results are sorted.
Task 1 is the starting of the other two tasks, creating the quiz that is needed for the other two
to function.
16 | P a g e
17 | P a g e
Contents
3. Introduction
4. Task 2
a) Analysis
b) Success criteria
c) Programming techniques
d) Variables and validation
e) Test plan
f) Algorithms
g) Development evidence
h) Testing
i) Conclusion
18 | P a g e
Introduction
Task 2
The teacher wants to keep track of the scores each member of the class obtains in
the quiz. There are
Three classes in the school and the data should be kept separately for each class.
Analyse the requirements in detail for this program and design, code, test and
evaluate a program that will record and store the data for three separate classes of
students using the arithmetic quiz.
Success criteria
The programme will also log the users name, age and form/class
The programme will allocate the scores gained by the students to the folder
associated with their form
Will record and store the data for three separate classes
19 | P a g e
Techniques
For this task, I will be using python as a high-level language and I have thought
about what techniques I will need to use this includes:
Variables something that will change, I will be using variables for answering
the test and as conditioning/validation. Like when I question = 0 #setting all
varibles to be empty and clear before the program runs
Iteration loop validation, to loop until answer is within validation ranges.
Like when I while question < 11: #this while loop will make sure that the
program underneath runs till the variable reaches a certain value
Conditioning validate sequence. Like when I else: #if not the correct
answer to the question then it will display the following
print "Incorrect,the correct answer = " + str(correct_answer) + "."
#tells you if you are incorrect and gives correct answer
Score - to mark questions right or wrong and mark accordingly and to count
and remember correct answers. Like when I marks = marks + 1 #adds 1 to
the mark variable
Operator - to use characters, such as (+*-). Like when I if operater_1 == 3: #
if operater_3 equals 3 the this loop becomes in action
print str(unit_1) + " - " + (unit_2) #adds 1 to the question variable so
that only 10 questions are asked no matter what generates the sum
question = question + 1 #adds 1 to the question variable so that only
10 questions are asked no matter what
answer = input() #user input for question
correct_answer = unit_1 - unit_2#program works out correct answer
Integers - number based answers (validation). Like when I unit_2 =
random.randint (1,10)
Functions to create functions such as random and time. Like when I import
time #imports functions for the possibility for time which allows you to create
stops in the program
Logic and or Not. Like when I while question < 11:
Write writes over the stored information. Like when I
log_maths_quiz.write(name) #this writes the value that is asigned to 'name'
in to the text file
Append add to the information. Like when I log_maths_quiz =
open('log_10c1.txt', 'a+') #creates or opens the file under the name inside of
the brackets if the file does not exist then it is created
20 | P a g e
Variable table
Variable name
answers
Data type
Alphanumeric
Numbers
Role
To answers
the math
questions
To input
gender
To input name
validation
To stop players from
entering words in
number questions
Male/female
gender
Boolean, yes/no
name
Text
arithmetic_operators
String
Plays a role in
the question
write
Information storage
logging
append
Information storage
read
Information storage
Overwrites
information
To record the
users name
and score
Adds to
information
Reads the
stored
information
To make sure
operator does on
repeat
Stores information
once
Logs name and score
21 | P a g e
Test plan
Success criteria
How tested
The program
must be able to
generate maths
quiz
to ask and
remember
students name
Must have a
range of random
integer
Must Not have
repetitive
questions
The programs
able to mark
questions and put
right answers
Must be able to
reset
Must cover all
arithmetic
operations(+-x)
Validation (name
has to be in
string)( answers
have to be
real/integers)
Questions must
be appropriate for
their age
Score the
questions
Questions must
be clear and easy
to understand
to Be able to read
the stored results
Expected
outcome
Will generate
the 10
questions
randomly
Action
Will remember
name and allow
long names
Will create
random integers
Will reset
Actual outcome
Will mark
correct and put
right answer
Validation will
work and only
appropriate will
be allowed to
be inputted
Will not create
too difficult
questions
Will score
questions
The question
will be easy to
understand and
make sense
Will be able to
be read
22 | P a g e
23 | P a g e
Flow chart
24 | P a g e
Pseudo code
Start
Input time
Input random
Input = name
Input = form
Open file = dependent on form
Character = check
Output = instructions/guide
Set question = 0
Set mark = 0
Output = random integers (1-99) random string (*-/+) random integers (1-99)
Input = answer
Character = check
Answer check
If correct question +1 mark +1
Repeat program
Else incorrect question +1
Repeat program
Elif question = 10
Start
test
Output marks
Saves marks to file
End
25 | P a g e
Test
Success criteria
How tested
The program
must be able to
generate maths
quiz
to ask and
remember
students name
Expected
outcome
Will generate
the 10
questions
randomly
Actual outcome
Will remember
name and allow
long names
Generated the
10 questions
randomly
Must have a
range of random
integer
Must Not have
repetitive
questions
The programs
able to mark
questions and put
right answers
Must be able to
reset
create random
integers when run
Will create
random integers
Remembered
name and
allowed long
names
Randomly
created integers
Will mark
correct and put
right answer
Marked correctly
and put right
answer
Will reset
Score the
questions
Will score
questions
Will be able to
be read
Questions must
be clear and easy
to understand
to Be able to read
the stored results
Validation will
work and only
appropriate will
be allowed to
be inputted
Will not create
too difficult
questions
The question
will be easy to
understand and
make sense
Action
Try to input a
restart loop
Answers were
only integers
Did not
approach
stopping
negative
questions
The questions
were easy to
understand and
made sense
Is able to log
information in
correct form and is
able to be read at
Did not
approach
repeats
26 | P a g e
attempted to be read
Log names and
data scores
a later date
Will run and
recorded
27 | P a g e
My test runs, asks for name and form then displays instructions it
then displays ten questions one by one and says whether u are
correct or incorrect if in
the case you are incorrect it displays the correct answer at the end of the
program it displays how many questions you got correct.
28 | P a g e
Conclusion
During task 2 I found the most difficult part about it was the learning of the new data
logging code, the easiest part was implementing the newly learnt code in to my
previously created code. My code work is, as the task wants it to logging the pupils
scores and name in the correct form folder as the task asked of the code. I ran in to
a few problems with the organisation of the files and many syntax errors because of
miss understandings in my code. I overcame every problem, my code originally was
over complicated and long I compressed it down and included many separate points
into one and that reduced my code down, reduced the possibility of errors, and made
the errors easier to see. This helps me improve my program and complete more
units of my success criteria but still had problems with certain aspects of my success
criteria such as approaching negative questions and repeating results from the same
user.
Must not have repetitive questions have not set up validation for this
based on the fact that the possibility of a question repeating in very slim.
Must cover all arithmetic operations (+-*/) the program uses all
operations
29 | P a g e
The programme will also log the users name, age and form/class the
program logs users names score and form
The programme will allocate the scores gained by the students to the
folder associated with their form the program allocates the users to the
correct form
Will record and store the data for three separate classes the program
will record the data
30 | P a g e
31 | P a g e
Contents
5. Introduction
6. Task 3
a) Analysis
b) Success criteria
c) Programming techniques
d) Variables and validation
e) Test plan
f) Algorithms
g) Development evidence
h) Testing
i) Conclusion
32 | P a g e
Introduction
Task 3
The teacher wants to use the results from students taking these quizzes to log their
performance. The system should store the last three scores for each student. The
teacher would like to be able to output the results of the quiz for a particular class,
sorted: in alphabetical order with each students highest score for the tests, by the
highest score, highest to lowest, by the average score, highest to lowest. Analyse the
requirements in detail for this program and design, code, test and evaluate a
program that will allow the teacher to select which class group to look at and which
field to use when sorting the output data.
In the previous two tasks Ive created programs that have run a maths quiz that
creates adding, subtracting, multiplication and division sums at random with random
integers however while we are still creating a quiz for task 3 the previous solutions
will not be suitable because in the previous tasks a .txt file was used and this would
not be compatible with task 3 because task 3 requires you to store the last 3 scores
of each student, sort in alphabetical order, by the highest score (highest to lowest)
and by average score (highest to lowest) this would not be able to be done in a .txt
file. Therefore, I would have to use a .csv file because this would allow me to do
things that a .txt file would not allow. For this task, I will also be introducing a GUI
(graphic user interface) to make the program more user friendly and easier to use.
Success criteria
Techniques
33 | P a g e
For this task, I will be using python, as a high-level language my program will be
using variables to state the amount of questions done and questions needed to be
done. Variables will also be used to record, store and show the score at the end. I
will be using loops in my program for validation so that users can only input valid
data such as integers (numbers) and string (letters and symbols) and not cause
errors in the program. I will be using constants to establish the same data throughout
such as names. I will be including operators into my program to make my
mathematic questions be more users friendly. I will be using functions such as
random to get random integers and operators also; I will be using GUI function in
order to make the quiz more users friendly.
Variables something that will change, I will be using variables for answering
the test and as conditioning/validation. Like when I question = 0 #setting all
varibles to be empty and clear before the program runs
Iteration loop validation, to loop until answer is within validation ranges.
Like when I while question < 11: #this while loop will make sure that the
program underneath runs till the variable reaches a certain value
Conditioning validate sequence. Like when I
Functions to create functions such as random and time. Like when I import
time #imports functions for the possibility for time which allows you to create
stops in the program
Logic and or Not. Like when I while choice == 0: # a while loop that set
continues while the variable choice is equal to 0
Append used to add to information. newlist.append(row[0:3]) # gives the
range of cells that will be edited
Csv file printing - for row in csv_f:
print row #prints csv file
34 | P a g e
35 | P a g e
Variable table
Variable name
Answers
Data type
Alphanumeric
Numbers
Role
To answers
the math
questions
To input
gender
To input name
validation
To stop players from
entering words in
number questions
Male/female
Gender
Boolean, yes/no
Name
text
Arithmetic operators
string
Plays a role in
the question
Write
Information storage
Logging
Append
Information storage
Read
Information storage
Name of class
String
Score
Integer
Quiz questions
Correct answers
String
Overwrites
information
To record the
users name
and score
Adds to
information
Reads the
stored
information
To open the
corresponding
form file
To recorded,
store and
display the
score
Puts out the
correct
number of
question
Program can
work out
correct
answers
To make sure
operator does on
repeat
Stores information
once
Logs name and score
36 | P a g e
Test plan
Success criteria
How tested
The program
must be able to
generate maths
quiz
to ask and
remember
students name
Must have a
range of random
integer
Must Not have
repetitive
questions
The programs
able to mark
questions and put
right answers
Must be able to
reset
Must cover all
arithmetic
operations(+-x)
Validation (name
has to be in
string)( answers
have to be
real/integers)
Questions must
be appropriate for
their age
Score the
questions
Questions must
be clear and easy
to understand
to Be able to read
the stored results
Expected
outcome
Will generate
the 10
questions
randomly
Action
Will remember
name and allow
long names
Will create
random integers
Will reset
Actual outcome
Will mark
correct and put
right answer
Validation will
work and only
appropriate will
be allowed to
be inputted
Will not create
too difficult
questions
Will score
questions
The question
will be easy to
understand and
make sense
Will be able to
be read
37 | P a g e
The programme
will allocate the
scores gained by
the students to
the folder
associated with
their form and
name
Will record and
store the data for
three separate
classes
The folders in
question will be
opened and
examined to see if
the information is
located where it is
meant to be
The information
is stored in
correct location
in correct format
Store in
alphabetical order
with each
students highest
score for the test
By the highest
score, highest to
lowest
The information
recorded will be
stored in correct
corresponded
file
The file will be
able to be
stored
alphabetically
38 | P a g e
Flow charts
Quiz subroutine
39 | P a g e
40 | P a g e
Evidence of errors
I had a print loop error in which multiple of the same detail would be displayed I fixed this by
moving the print function
41 | P a g e
Pseudo code
Import csv, time, sys
While selectclass == 0:
Selectclass = raw_input (please selectclass )
If class is 1
open class 1
If class is 2
open class 2
If class is 3
open class 3
while choice == 0:
print select option 1,2,3,4
if choice == 1:
print scores
elif choice ==2:
print average score
elif choice ==3:
print max score
elif choice ==4
print min score
42 | P a g e
43 | P a g e
my program runs and asks for the form you wish to view then gives you 4 options on
what to do with the results in the picture I have shown the scores. The program
displays the scores and then gives you the option to see the options again; I said no
and asked the program to end.
44 | P a g e
Conclusion
For task 3, I had to approach the programing from a different angle, because the
ways the sorting and saving the results interacted with the quiz so I took step back
and revisited the task that was set, and realized that the quiz was not asked to be
included in the program so I removed it completely and stuck to completing strictly
what the task asked me to do. Which was to have a program that could store and
sort results, which my program does.
Task 3 differs from the other two tasks because it utilises a record database (DBMS,
database management system. Captures and analyses data), its a record database
because there are multiple fields (basic unit of data) the fields are name, score,
maximum, minimum and average. Storing information like this is far more organised
and efficient for sorting and manipulating.
My program completes most of my success criteria with only a few minor problems
that could have been resolved with more time and a second set of eyes to spot
obvious bugs (software error, flaw or fault that causes an incorrect or unexpected
result)
Must be able to reset the program resets and goes back to the
original multi choice menu.
Will store the students last 3 scores the program stores and
displays the last 3 scores and organises based on the 3 scores.
45 | P a g e
Save to a csv file the program organises and saves the results
to the csv file also retrieving the information from the csv file.
46 | P a g e