GCSE NEA

Advice and guidance on completing the NEA Task

GCSE NEA
What is the NEA?
What do you have to do…

The NEA is a task set by the exam board AQA to give you real world experience of designing and and producing a coded solution to a problem.

As part of the process, you are required to produce evidence of the following aspects:

• Designing the solution
• Creating the solution
• Testing the solution
• Potential enhancements and refinements.

The evidence you produce will take the form of a report.

Designing the solution
How to present your work…

Variables to be used

Create a table that lists all of the variable names, their data types and what they will be used for, an example is shown below:

Error

Validation to be Used

Make a list of the different validation you will try to include in your solution to prevent invalid input. You can either make this as a set of bullet points or use a table like the example below:

Error

Test Plan

Use the table layout below when creating your test plan. The test plan should have the Actual Outcome and Pass/Fail left blank until it is completed in the testing section at the end.

Error

Annotation of Code

Below are two examples of code annotation, one is a poor example as it doesn’t explain how the code works, it just identifies what sections do very briefly.

#user inputs
adults = input("Enter the number of adults: ")
children = input("Enter the number of children: ")
#works out the cost
adulttotal = int(adults) * 5
childtotal = int(children) * 3
grandtotal = adulttotal + childtotal
#displays the cost
print(adults + " adults and " + children + " children will cost a total of £{:.2f}".format(grandtotal))
#asks the user to input the number of adults and stores it in the adults variable
adults = input("Enter the number of adults: ")
#asks the user to input the number of children and stores it in the children variable
children = input("Enter the number of children: ")
#works out the adult cost by multiplying the number of adults by £5 and storing it in adult total
adulttotal = int(adults) * 5
#works out the child cost by multiplying the number of children by £3 and storing it in child total
childtotal = int(children) * 3
#works out the grand total by adding the adult total to the child total
grandtotal = adulttotal + childtotal
#displays the cost for the number of adults and number of children
print(adults + " adults and " + children + " children will cost a total of £{:.2f}".format(grandtotal))
Presenting Algorithms
How to represent your solution to a problem…

It is strongly recommended that you represent your solution design using pseudocode. Below is a series of different programs that have pseudocode and flowcharts completed for them. Use them to try and relate your algorithm designs to your code.

Example 1 - Teddy Bears Program - Sequencing

hours = int(input("Enter the number of hours worked: "))
bears = int(input("Enter the number of teddy bears made: "))
hourswage = hours * 7
bearswage = bears * 0.45
total = hourswage + bearswage
print("Your total wage is: £{:.2f}".format(total))
Error
Error

Example 2 - Water Temperature Program - Selection

fahrenheit = float(input("Enter the temperature of the water in fahrenheit: "))
centigrade = (fahrenheit – 32) * (5/9)
if centigrade <= 0:
    print("Water Frozen")
elif centigrade >=100:
    print("Water Boiling")
else:
    print("Water is neither frozen or boiling")
Error
Error

Example 3 - Average Calculator - Iteration (FOR)

total = 0
numbers = int(input("How many numbers do you want to enter? "))
for x in range(numbers):
    latest = int(input("Enter a number: "))
    total = total + latest
average = total / numbers
print("The total of the numbers was " + str(total))
print("The average of the numbers was " + str(average))
Error
Error

Example 4 - Menu Selection - Iteration (WHILE)

print("What would you like to do?")
print("1. Play Game")
print("2. Instructions")
print("3. Quit")
valid = False
while valid==False:
    option = int(input("Enter which option you want: "))
    if option == 1 or option == 2 or option == 3:
        valid=True
print("Let's go")
Error
Error

Example 5 - Login System - Reading from a File

username = input("Please enter your username (email address): ")
password = input("Please enter your password: ")
file=open("Logins.csv","r")
found = False
for line in file:
    details=line.split(",")
    if details[0] == username and details[1] == password:
        found = True
        print("Email: " + details[0])
        print("Name: " + details[2] + " " + details[3])
        print("Address:\n" +details[4] +"\n"+details[5]+"\n"+details[6])
if found == False:
    print("Incorrect login details entered")
Error
Error

Example 6 - Product Catalogue - Writing to a File

another = "Y"
while another == "Y":
    barcode = input("Enter an 8 digit barcode: ")
    description = input("Enter a product description: ")
    price = input("Enter a price: ")
    file=open("Products.csv","a")
    file.write(barcode + "," + description + "," + price)
    file.close()
    print("Product added to catalogue")
    another = input("Do you want to add another? Y/N ")
Error
Error

Example 7 - Measurement Conversion - Functions

def mtokm(value):
   answer = value*1.6
   return answer

def kmtom(value):
   answer = value*0.62
   return answer

print("What conversion would you like to do?")
print("1. Convert Miles to Kilometres")
print("2. Convert Kilometres to Miles")
option = input(">>")
print()
number = float(input("Enter your measurement to convert: "))
if option=="1":
   print(str(number) + " miles in KM is " + str(mtokm(number)))
elif option=="2":
   print(str(number) + " KM in miles is " + str(kmtom(number)))
else:
   print("Please enter a valid selection")
Error
Error
Testing
How to plan and carry out effective testing…

When you complete the testing section of your project you need to make sure your testing table is specific and attempts to test all possible inputs.

Below are a series of programs and completed testing tables so you can see how you should complete the testing tables.

Example 1 - Email Address Validation


This program gets the user to enter an email address and it will decide if it is valid or not. The email address must follow the following format:

  • start with a string of alphanumeric characters
  • followed by the @ symbol
  • another string of alphanumeric characters
  • followed by a “.”
  • then a string of alphanumeric characters

Program code:

import re
password = input("Enter an email address: ")
while len(password)==0:
    password = input("Enter an email address: ")
pattern = "^[A-Za-z0-9]+\@[A-Za-z0-9]+\.[A-Za-z0-9]+$"
passwordMatch = re.match(pattern, password)
if passwordMatch:
    print("VALID")
else:
    print("INVALID")

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error

Test 4

Error

Test 5

Error

Example 2 - Grade Calculator


This program gets the user to enter a test score between 0 and 100. It will then say the grade and how many marks they are off the next grade. The grade boundaries are:

  • A = 70+
  • B = 60+
  • C = 50+
  • D = 40+
  • U = <40

Program code:

valid=False
while valid==False:
    score = input("Enter a score between 0 and 100: ")
    if score.isdigit()==False:
        valid=False
    else:
        valid=True
        if int(score)<0 or int(score)>100:
            valid=False
score=int(score)
if score >=70:
    marksoff = 100-score
    print("That test score is a grade A, you were "+str(marksoff)+" marks off full marks")
elif score>=60:
    marksoff = 70-score
    print("That test score is a grade B, you were "+str(marksoff)+" marks off an A")
elif score>=50:
    marksoff = 60-score
    print("That test score is a grade C, you were "+str(marksoff)+" marks off a B")
elif score>=40:
    marksoff = 50-score
    print("That test score is a grade D, you were "+str(marksoff)+" marks of a C")
else:
    marksoff=40-score
    print("That test score is a grade U, you were "+str(marksoff)+" marks off a D")

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error

Test 4

Error

Test 5

Error

Testing table

Error

Testing evidence

Test 6

Error

Test 7

Error

Test 8

Error

Test 9

Error

Test 10

Error

Example 3 - Speeding Cars


This program reads a file that contains a list of car registration plates and the speed they were captured at going through a speed camera. The user will enter the speed limit and it will display which of the cars in the file were speeding. Part of the file cars.csv is shown below:

Error

Program code:

speed = input("Enter the speed limit (mph) ")
file = open("cars.csv","r")
speeding = False
for line in file:
    cars = line.split(",")
    if float(cars[1])>float(speed):
        speeding = True
        print(cars[0] + " " + cars[1])
file.close()
if speeding == False:
    print("There were no cars that broke the speed limit of " + speed + "mph")

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error

Example 4 - Order Program


This program reads a file that contains a list of products and their prices sold in a shop. The user enters a GTIN code (barcode) and how many the customer wants. It then calculates the total cost of each item and a grand total and creates a receipt.

Products.csv is shown below:

Error

Program code:

anotherItem=True
receipt=""
totalcost=0
while anotherItem is True:
    gtin = input("Enter a GTIN8 Number: ")
    quantity = input("Enter a quantity: ")
    file=open("Products1.csv","r")
    itemFound=False
    for line in file:
        product=line.split(",")
        if product[0]==gtin:
            price=float(product[2])
            itemFound=True
            itemTotal=round(price*int(quantity),2)
            receipt=receipt+"\n"+product[0]+" "+product[1]+" "+quantity+" "\
                     +"£{:.2f}".format(price)+" "+"£{:.2f}".format(itemTotal)
            print("Current Order")
            print(receipt)
            totalcost=totalcost+itemTotal
    file.close()
    if itemFound==False:
        receipt=receipt+"\n"+gtin+" product not found"
        print(receipt)
    continueOrder=input("Order another item (y/n)?")
    if continueOrder=="y":
        anotherItem=True
    else:
        anotherItem=False
print("Order complete")
receipt=receipt+"\n"+"Total cost of order £{:.2f}".format(totalcost)
print(receipt)

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error

Test 4

Error

Example 5 - Reorder Program


This program reads a file that contains a list of products and how many there are in stock. If the number in stock is low, it works out how many need to be reordered and then creates a new file of the products that need to be reordered as well as how many.

Program code:

print("List of products that are below the reorder level and need to be reordered:")
itemsforreorder=0
file=open("catalogue - T3.csv","r")
for line in file:
    product=line.split(",")
    if int(product[3])0:
    print("Reorder file created")
else:
    print("No products need reordering")

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error

Example 6 - Updating Staff Information


This program updates the number of years a member of staff has been working at the school. When the program runs the user enters their email address, when it finds the person it asks them to enter their number of years teaching. It will then update the file if the person exists in the file.

Program code:

import os, sys
updateanother = "Y"
while updateanother == "Y":
    email = input("Enter the email address you are looking for:")
    file = open("staff.csv","r")
    alreadyexists=False
    for line in file:
        staff = line.split(",")
        writefile = open("staffupdated.csv","a")
        if staff[2] == email:
            alreadyexists=True
            print("Current Details:\nStaff name: " + staff[0] + " " + staff[1] + "\nEmail Address: " + staff[2] + "\nYears Teaching: " + staff[3])
            yearsteaching =input("Enter their new number of years teaching: " )
            writefile.write(staff[0] + "," + staff[1] + "," + staff[2] + "," + yearsteaching+"\n")
        else:
            writefile.write(staff[0] + "," + staff[1] + "," + staff[2] + "," + staff[3])
        writefile.close()
    file.close()
    os.remove("staff.csv")
    os.rename("staffupdated.csv","staff.csv")
    if alreadyexists==False:
        print("That staff member's email cannot be found in the file, no changes made")
    else:
        print("Details updated")
    updateanother = input("Would you like to update another staff member? Y/N ")

Testing table

Error

Testing evidence

Test 1

Error

Test 2

Error

Test 3

Error
If you need to get in touch with Mr McG then this is the way….

What's your name?
image/svg+xml
Thank you [name], that's great.

Can I ask where you are from?
image/svg+xml
Hey [name], can I ask where you are from?
image/svg+xml
Hey [name], which class are you in?
image/svg+xml
OK [name], thanks for that.

I will need your email address so I can get back to you!!
image/svg+xml
Thanks [name], nearly there.

What can I help you with?
image/svg+xml

Thanks [name] from [whichclass][location], Mr McG will get your message…"
[message]"…and will get back to you ASAP via [email]. Catch you soon.

image/svg+xml
Thank you [name], Mr McG got your message.
Thanks [name], Mr McG will get back to you as soon as he can!!

Have a great day!!

K McGuinness - 2018

No personal data will be shared with any third party. The only data processed via this website is anonymous browsing data to best manage your user experience.