Upload
marilyn-cole
View
214
Download
0
Embed Size (px)
Citation preview
Noadswood Science, 2014
To set out and solve an identified problem
Wednesday, April 19, 2023
Box ‘a’ Box ‘b’
2 3
Box a is smaller than Box b…
Boxes
Mini Project I – create two boxes and have user input some numbers representing each box. Produce an output for these user inputs which says their sizes in relation to one another: - Box A (size x) is bigger than Box B (size y) Box B (size y) is bigger than Box A (size x) Box A (sixe x) is the same size as Box B (size y)
Usability test – is it clear for the user with what they have to do, as well as what is outputted?
Error test this – can it be broken?
Go from planning the idea, to a first draft version, to a beta test version to final product, along the way explaining what worked and what did not and how this was rectified!
User Guide
You need to submit a user guide alongside your program (the user guide is actually more important than a working program)!
The user guide should include the following: - Design the solution
▪ What is the problem▪ How are you going to solve it (include flow charts and Pseudo code)
Solution development▪ How will your program complete the tasks required▪ Annotated code and screen shots of key features and functions
Programming techniques▪ What parts of the program have been designed and how do they work▪ Why were certain features included (identify data structures)▪ Identify how the system is robust
Testing and evaluation▪ Test plan identifying what tests will be carried out / data tests / expected results▪ Actions taken from test results ▪ Evaluation of the final product
Boxes – Designing The Solution
A problem has been set where a user needs to input two numbers and then the program work out which is bigger
Information needs to be displayed for where the user is to input numbers and then a statement as to which is bigger must then be displayed
There are three possible outcomes (excluding errors in input): - Box A (size x) is bigger than Box B (size y) Box B (size y) is bigger than Box A (size x) Box A (sixe x) is the same size as Box B (size y)
10 1 1 10 5 5
Box ‘a’ is bigger than Box ‘b’
Box ‘a’ is smaller than Box ‘b’
Box ‘a’ is the same size as Box ‘b’
Boxes – Designing The Solution
inputs Box_A
process value sizes
output sizes
int?
int?
input Box_B
Boxes – Designing The Solution
inputs Box_A
process value sizes
output sizes
int?
int?
input Box_B
Ask for an input from the user
Ask for an input from the user
If not an integer value then ask user to re-enter
If not an integer value then ask user to re-enter
Sum the two numbersDisplay on screen the size of the two numbers and which
is bigger
Pseudocode
Box size function
input values for box A and box B
for each value
check it is an integer
if it is move to next item
output if A > B
output if A = B
Function takes an input from user
Multiple inputs are required
Inputs are checked if they are integers
if it is not an integer return to input
output if A < B
If inputs are integers move onto processing
If inputs are not integers go back to input
Output based on process calculation
Boxes – Solution Development
Input for Box A and Box B
Boxes – Solution Development
Output after processing
Boxes – Solution Development
Error loop
Boxes – Programming Techniques
One of the initial setups is to test the math within Python and produce an output
In the first instance this can be tested with pre-assigned numbers for Box_A and Box_B
Box_A = 10Box_B = 20if Box_A == Box_B: print('Box A and Box B are the same value')if Box_A > Box_B: print('Box A is bigger than Box B')if Box_A < Box_B: print('Box A is smaller than Box B')
Boxes – Programming Techniques
The second task was to allow the user to input numbers
Box_A = input(‘Please enter a value for Box A: ‘))Box_B = input(‘Please enter a value for Box B: ‘))
It was then decided it would look nicer if a message appeared confirming the numerical input
Box_A = input(‘Please enter a value for Box A: ‘))Box_B = input(‘Please enter a value for Box B: ‘))print('Thanks! You entered a value of', Box_A, 'for Box A and a value of',
Box_B, 'for Box B')
This worked, however the program could easily be broken if an integer was not entered…
Boxes – Programming Techniques
The ensure the user only entered an integer a while loop was added for both inputs…
while True: try: Box_A = int(input('Please enter a value for Box A: ')) except ValueError: print("Sorry, you need to enter a whole number") continue if Box_A >= 0: break
while True: try: Box_B = int(input('Please enter a value for Box B: ')) except ValueError: print("Sorry, you need to enter a whole number") continue if Box_B >= 0: break
Boxes – Programming Techniques
#Boxeswhile True: try: Box_A = int(input('Please enter a value for Box A: ')) except ValueError: print("Sorry, you need to enter a whole number") continue if Box_A >= 0: break
while True: try: Box_B = int(input('Please enter a value for Box B: ')) except ValueError: print("Sorry, you need to enter a whole number") continue if Box_B >= 0: break
print('Thanks! You entered a value of', Box_A, 'for Box A and a value of', Box_B, 'for Box B')if Box_A == Box_B: print('Box A and Box B are the same value')if Box_A > Box_B: print('Box A is bigger than Box B')if Box_A < Box_B: print('Box A is smaller than Box B')input()
Boxes – Testing & Evaluation
The program is then tested and commented upon with the mark scheme stipulating the following: -
There is a full or nearly full test plan that shows all or nearly all of the expected tests and includes the full test data to be used and the expected results
There is evidence that all or almost all of the planned tests have been carried out and a detailed record of the results has been produced showing the extent to which every test was successful. There is evidence that all or almost all of the required remedial action has been carried out.
There is an evaluation discussing how the final solution meets all or nearly all of the original needs of the user. The evidence is accurately spelt, punctuated and grammatically correct to make the meaning clear. The form and style of writing is appropriate. Information is clearly organised and specialist vocabulary has been used appropriately.