Professional Documents
Culture Documents
System
Flowchart + Debugging-
Dawid P.
Programming + GUI +
Google Doc -
Nakshatr V.
1
A GCSE computer science OCR
project
Pages:
Section 1:......................................................................3
The Scenario.................................................................3
Section 2:......................................................................5
The Programming.........................................................5
Section 2A:....................................................................6
Setting Constants.........................................................6
Section 2B:....................................................................7
Adding Customers.......................................................7
Section 2C:..................................................................14
Selecting Customers..................................................14
Section 2D:..................................................................16
Integration of Functions into the Finalised Code....16
Section 3:....................................................................22
Tkinter GUI..................................................................22
Section 4:....................................................................34
‘Program in Action’....................................................34
2
Section 1:
The Scenario
3
4
Section 2:
The Programming
(Logic of the base program)
5
Section 2B - Adding Customer
Section 2C - Selecting Customer
Section 2D - Integration of functions
in finalised code
Section 2A:
Setting Constants
6
Section 2B:
Adding Customers
7
(efficiency in computers: the number
of computational resources used by an
algorithm and time taken by an
algorithm to produce the desired
result.)
Part 1
Gathering customer details
1. Creates a function
‘add_customer’
2. Tells the user that they will
write to the file
8
3. Inputs customer’s details
(name, street, town, postcode)
which are used later on when
assigning values into final output.
Part 2
Gathering Job Details
Part 3
Calculations for each type of
underlay
(This part will be split into 3.1-3.3)
3.1
“First Step”
10
(When stating features of these sections, the
line number of the code is often referred to)
This part of the program:
11
6. Calculates the overall cost for the
carpet (line 44)
7. Calculates the total price for the
(line 48)
9. Sets the whole IF statement into
3.2
“Monarch”
12
This part of the program:
3.3
“Royal”
13
This part of the program:
Section 2C:
Selecting Customers
14
block under the person with the first
name of input is found. This is then
outputted back to the user but in
addition, it also outputs the last
name of the person, creating a full
name.
(INPUT EXAMPLE: [Nakshatr])
(OUTPUT EXAMPLE: [Nakshatr
Velagapudi])
(OUTPUT EXAMPLE 2: [No such
customer in file])
(To note: this program only outputs user first in
file, even if same first name is present later on)
15
1. Asks user to input first name of
user
2. Reads the .txt file (as ‘f’)
3. For each line in the list [lines],
it iterates in FOR loops to perform
PART 4.
4. If the users input (first name) is
valid in the line, it prints the whole
line (Which is the whole name)
5. Otherwise (else), it outputs the
fact that there isn’t ‘such customer
in file’
Section 2D:
Integration of Functions into the
Finalised Code
16
ultimately done by integrating these
functions within the conditional
(IF/ELSE) statements. However, to
ensure seamless operation, we first
establish sections for the user to
read data. This section will be
separate to the IF/ELSE statements,
but technically falls into the same
category as its primary purpose is
to enhance user experience during
data reading.
17
(This section falls into the function
‘add_customer’)
18
19
Section 2D: Integration of functions
(Final subsection for Section 2)
Step 1:
Ask users if they wish to ADD a new
customer, or SELECT an existing
customer.
20
Step 2:
If the user chooses to select a new
customer:
21
Section 3:
Tkinter GUI
The GUI:
22
To Note:
This GUI program follows the same
logic, but just transforms into an
interface.
Step 1:
Import tkinter
23
Messagebox is used for this program,
as it is much easier to operate and in-
built to tkinter.
Step 2:
Variables from logic program/also
referred to as ‘main.py’
Step 3:
24
Using entry.get() to create entry boxes
and implements data from the
‘customer_add’ function in ‘main.py’
Step 5:
Copy paste in the same if/else/elif
statements used in ‘main.py’ for each
underlay material
25
Step 6:
Copy paste the formatting of the
quotation.txt file into GUI program
(because even for GUI project, txt file is
required to store data)
26
Step 7:
Copy paste the file organisation from
‘main.py’
27
(“Information” in that line refers to the
heading of the messagebox that pops
up)
Step 9:
Allow user to choose either to add
customer into the file or select out
from. (Note: the user does not input this
into the GUi file, but rather into the
console, which then redirects user to
GUI or returns selected name from txt
file
28
Step 9.5:
If user chooses to add customer, then
they are redirected to messagebox
Step 10:
Create label entry sections for all
details required to be inputted.
29
30
(Label refers to subheadings over the
entry box. Pack refers to ‘print[ing]’)
Step 11:
Allows user to select the underlay type
using the built in function ‘OptionMenu’
Step 13:
Create a submit button, for the user,
when they’re done entering customer
information.
31
- tk.button() function where it
generates a button (text is added)
- Packed directly into messagebox,
below entry boxes
Step 12:
Use tkinter function: ‘.mainloop()’ so
that the program will run for the user
until the user decides to quit program
Step 14:
Copy paste the ‘select’ function from
main.py, as the function remains the
same regardless of GUI
32
(This is the same program that is used
in Section 2D: Step 2)
33
Section 4:
‘Program in Action’
34
Firstly, the program will output 2
choices for the user:
To add customer
To select customer
35
‘Add’
36
For example:
37
Once the user clicks ‘Submit’, an
Information Box pops up:
38
Now, all this information is then
transferred to ‘quoatations.txt’ file,
where it is stored
‘Select’
39
If the user, in the console, chooses
‘select’, then they remain in the console.
40
If there is no such customer in the txt
file, then, it outputs so, and breaks the
program.
41