That Blue Square Thing

This page includes tooltips. Mouse over them to get a brief explanation of what something means.
Tootips might not work so well on phones or tablets. Sorry.

AQA Computer Science GCSE

This page is up to date for the new AQA 8525 syllabus for the 2022 exam. Make sure you check the revision pages to see which topics will be on the 2022 exam.

Programming Exam Question - Taxi firm

This is a seven mark paper 1 programming question. It was question 5 on the specimen exam paper.

I suggest trying to write an answer by hand first and then attempting to program your answer. Does it work? What did you get wrong?

The Question:

Write a Python program that allows a taxi company to calculate how much a taxi fare should be.

The program should:

You should use meaningful variable name(s), correct syntax and indentation in your answer.

The answer grid contains vertical lines to help you indent your code accurately.

[7 marks]

Hints

You can uncover a set of hints below.

With a pencil and some paper. Really: try and do this by hand first. That way when you try it in Python the syntax errors will get picked up and you'll learn from your mistakes. Lots of people find writing code by hand difficult. The only way to learn is to do it.
This is the first programming question on the exam paper, so it's quite simple. It's just a set of calculations. Some things to note:
  • the first thing to do is to get the user to enter the two values needed - this is worth 2 marks by itself! I have a page about how to input (and output) values if you need it
  • data entered in Python always comes in as a string. You need to convert it - this is worth a mark (see the link above)
  • there's a mark for using meaningful variable names even if you get the program very wrong indeed
  • you don't need to add anything to the program: no need for a title, fancy outputs or anything like that. Just do the things the question wants
I might get around to putting up a solution and a markgrid at some point, but I'm not going to do that yet. Some people might know where the markschemes are anyway. That's fine - but I'd try and do the task first
You don't need it. Just use a piece of paper and make sure your indents are clear

Suggested Test Data:

Because no validation is required, you could enter any values. I don't think you need to make this too complicated, so start with just integers as the data entry values. I'd suggest the following as simple tests:

Test type Test data Expected result
Normal data Passengers: 3
Distance: 4
12 - this is expected data with a simple calculation. Both entries are integers; output is an integer
Normal data Passengers: 6
Distance: 3
16.50 - this is expected data with a simple calculation involving . Both entries are integers; output is a real number
Boundary data Passengers: 1
Distance: 1
3.50 - this is expected data but with the lowest values possible and a simple calculation. Both entries are integers

To make your program more complicated, you could test entering real numbers for the distance. This is a more complete solution, but is not required by the markscheme - you can choose just to use integers.

Test type Test data Expected result
Normal data Passengers: 3
Distance: 3.14
10.71 - this is expected data with a calculation involving real numbers. One entry is a real number; the output is a real number
Boundary data Passengers: 1
Distance: 0.1
2.15 - this is expected data with the lowest values possible. One entry is a real number; the output is a real number

I don't think there's any point testing invalid data in this case - entering 3.2 passengers or "fishy" for the distance is pointless as it should fail. If validation was required I'd be aiming to test these sorts of things for sure.

What is Validation?

You can find out more about validation and verification in the programming projects section of this site. Validation is something you need to know for Paper 1 exams - it's Unit 2, section 3.2.11

A note about copyright

The question text has been published openly on the web by AQA. That is copyrighted to them. The other words on this page are mine.

I'm using this here because the children I teach need to work on how they write exam answers - and are a cohort massively impacted by COVID. I think, given that the questions have been published openly, that there is a fair-use educational rationale for putting them up here.

Note that I'm not putting them in a book, selling them on the TES or gaining any advertising revenue or being paid in any other way for running this website. But I am aware that I'm in a copyright grey area. If that's a problem, contact me.