Question 14
AQA Computer Science June 2018 Paper 1AS10 marks
On the specification
- 14.1
- 3.1 Fundamentals of programming3.5 Fundamentals of data representation
- 14.2
- 3.3 Systematic approach to problem solving
Question text
14 This question will further extend the functionality of the program. Before sending a message in Morse code the message is to be encrypted using a Caesar cipher. To encrypt a character (letter or space) it is shifted a given number of places (the key) in the alphabet (space is taken as the first character, then A, B, C and so on to Z). If a character is required before space or after Z then wrap-round is to be implemented. For example: • if the key is 2, then SPACE is encrypted as B, A is encrypted as C, B is encrypted as D, …, X is encrypted as Z, Y is encrypted as SPACE, and Z is encrypted as A. • if the key is -1, then SPACE is encrypted as Z, A is encrypted as SPACE, B is encrypted as A, …, and Z is encrypted as Y. Three different keys are to be used depending on the position of the character in the message. The first character in the message is to be encrypted using the first key, the second character is encrypted with the second key and the third character with the third key. The fourth character is then encrypted using the first key again, the fifth character is encrypted with the second key and the sixth character with the third key and so on. The three keys are repeatedly used like this until the end of the message. What you need to do: Task 1 At the start of the subroutine SendReceiveMessages add code to enter three values that must be integers (the keys). Task 2 Amend the subroutine SendMorseCode to encrypt the message using the substitution method described above and the keys entered by the user. Task 3 Test that your code works by conducting the following test: • run the program • for the first key enter 17 • for the second key enter 5 • for the third key enter -3 • enter S • enter the string TEA X Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 14.1 Your amended PROGRAM SOURCE CODE for the subroutines SendMorseCode and SendReceiveMessages. [9 marks] 14.2 SCREEN CAPTURE(S) showing the keys entered, the plain text and the encrypted Morse code message. [1 mark]