Smith_Lauren_58243_Cand.No_Text_Encryption_CA

advertisement
oiiiiiiiiiiiiiiiiiiiiiiiiiiiiliollkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
AQA COMPUTER SCIENCE
4512/1 PRACTIAL PROGRAMMING
SCENARIO 4
LAUREN SMITH
3667
58243
Lauren R Smith
1
Design of solution
User Needs:
1. The user will need a Display Menu to
o Encrypt message
o Decrypt message
o Exit
2. The user will need the computer to ask what file to open- to encrypt
3. The user will need the computer to Generate + Display 8 character key
4. The user will need the computer calculate offset
1
Flow Chart of user needs
2
Solution Development:
Task 1:
This file displays encryption and decryption, it asks the user if they
wish to decrypt, encrypt or exit programme, by using 1, 2 and 3.
2
Testing:
Task
No.
Description
Test
Data
What do you
EXPECT to
happen
What ACTUALLY
happened?
Further Action
Required
TASK 1
1.1
Menu task
Menu task
1
‘Encrypt’ will
display on screen
None
1.2
Menu task
2
1.3
Menu task
3
1.4
Menu task
Hello
1.5
Menu task
6
1.5
Menu task
###
‘Decrypt’ will
display on screen
‘Exit’ will display
on screen
An error to
display on screen
‘Invalid’ display
‘selection’ on
screen
Error to occur on
screen
‘Encrypt’
displayed on
screen
‘Decrypt’ displayed
on screen
‘Exit’ displayed on
screen
Error displayed on
screen
‘Invalid selection’
displayed on
screen
Error displayed on
screen
What ACTUALLY
happened?
Further Action
Required
Task No.
Description
TASK 2
Read File
Read File
Read File
Read File
Read File
Read File
Read File
2
Test
Data
What do you
EXPECT to
happen
None
None
Try to fix
None
Try to fix
Programming Techniques
Task 1 Menu
Technique
Where used and why
Print ()
To display menu on the screen.
Input()
To allow the user to enter their answer.
If()
To ask whether a condition is true or false.
Elif()
Allows you to check multiple expressions for TRUE and
execute a block of code as soon as one of the conditions
evaluates to TRUE.
Contains the block of code that executes if the conditional
expression in the if statement resolves to 0 or a FALSE value.
Else()
Task 2 Read File
Technique
Open ()
Print ()
2
Where used and why
Task 3 Read File
Technique
Print ()
Import ()
Int ()
2
Where used and why
Task 1
2
Data
structure
type
Variable
Data
Type
Purpose
1
Data
structure
name
Selection
Integer
1
Turn
Variable
Integer
Used to store the
selection that
the user entered
at the menu
Allows the user
to have more
than one turn
Task 3
Generate key
Technique
Where and when its used
Import random
Brings in the random library
Radiant
Displays random variety of
numbers
Range()
Generate a list of numbers for
the loop
Chr()
Chr is the character
TASK 4
2
Download