For this challenge you will create a flowchart to explain the process that a computer will have to follow to calculate the entry fees to an aqua park for a small group of visitors or a family.
Below is the price list of the aqua park:
Video Tutorial
Watch the video tutorial for step by step instructions on how to complete this challenge.
Task 1: Design the Flowchart
First you will design the flowchart for your algorithm. The aim is your algorithm is to:
- Ask the user how many adult tickets are needed,
- Ask the user how many child tickets are needed,
- Calculate the total cost of this order,
- Decide if this order qualifies for a 5% discount and if so, calculate the new total cost of the order,
- Output the total cost of the order.
Task 2: Python Code
Once your flowchart is complete, implement your algorithm using Python code.
Task 3: Test Plan
Test # | Type of Test | Input Values | Expected Output | Actual Output |
#1 | Valid | Adults: 2 Children: 1 |
Total Cost: £41 | |
#2 | Valid | Adults: 1 Children: 0 |
Total Cost: £15 | |
#3 | Valid | Adults: 2 Children: 3 |
Total Cost: £59.85 | |
#4 | Valid | Adults: 5 Children: 12 |
Total Cost: £196.65 | |
#5 | Valid Extreme | Adults: 0 Children: 0 |
Total Cost: £0 | |
#6 | Erroneous | Adults: abc Children: xyz |
Error Message |
Task 4: Adding extra validation routines
Tweak your code to add some validation routines when capturing user inputs. For instance, you want to make sure that the user only enters a positive integer value when asked for the number of tickets required.
You might find this blog post useful to ensure the user provides an integer value when asked to do so.
Adding validation routines when capturing user inputs is always a good approach to improve your programs and make them more robust.
You can investigate other forms of validation routines on this page.
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area